473,657 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use <script> inside function ?

Hi,
I am stuck with ideas guys ....

Can someone please tell me what I did wrong in the code below ? I think
it might be the <script> tag inside the function ?

Thank you
<SCRIPT LANGUAGE="JavaS cript">
function playasound(thes ound,thename,th emethod)
{
if (themethod = 'W' || themethod = 'M' ){
var s=parent.pageba s.document;
s.open();
s.write('<html> <head></head><body bgcolor="#00999 9"
text="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0 ">');
s.write('<div align="center"> <TABLE align="center" BORDER="0"
CELLPADDING="0" CELLSPACING="0" WIDTH="520"><TR ><TD
width="400" bgcolor="#00000 0">');
s.write('<div align="center"> <font color="#FFFFFF" face="Arial,
Helvetica, sans-serif" size="-2">');
s.write('Now loading and playing .... <i>',thename, '</i> .....
</font>');
s.write('<embed src="',thesound ,'" height="20" width="100" hidden
autoplay="true" >');
s.write('</embed></div></TD></TR></TABLE></div></body></html>');
s.close();
}
else if (themethod = 'X' || themethod = 'N'){
var s=parent.pageba s.document;
s.open();
s.write('<html> <head></head><body bgcolor="#00999 9"
text="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0 ">');
s.write('<div align="center"> <TABLE align="center" BORDER="0"
CELLPADDING="0" CELLSPACING="0" WIDTH="520"><TR ><TD
width="400" bgcolor="#00000 0">');
s.write('<div align="center"> <font color="#FFFFFF" face="Arial,
Helvetica, sans-serif" size="-2">');
s.write('Now loading and playing .... <i>',thename, '</i> .....
</font>');
s.write('<SCRIP T LANGUAGE="JavaS cript">
s.location.href ="',thesound ,'" </script>');
s.write('</div></TD></TR></TABLE></div></body></html>');
s.close();
}
}
</SCRIPT>
Aug 2 '05 #1
4 1714
bunch92 <bu*****@yahoo. fr> wrote in
news:Xn******** *************** *****@213.123.2 6.234:
Hi,
I am stuck with ideas guys ....


Got it ...
I needed <\/script>
Aug 2 '05 #2
bunch92 wrote:
Hi,
I am stuck with ideas guys ....

Can someone please tell me what I did wrong in the code below ? I think
it might be the <script> tag inside the function ?

Thank you
<SCRIPT LANGUAGE="JavaS cript">
Language is depreciated, type is required.

<script type="text/javascript">
function playasound(thes ound,thename,th emethod)
{
if (themethod = 'W' || themethod = 'M' ){
Did you really mean assignment above or is evaluation required?

if (themethod == 'W' || themethod == 'M' ){

That is why it is often recommended to write comparisons with string
literals with the string on the left so that assignment will cause an
error rather than always be true:

if ( 'W' == themethod || 'M' == themethod ){

Otherwise the else statement will never be executed.

[...]
else if (themethod = 'X' || themethod = 'N'){


else if ( 'X' == themethod || 'N' == themethod ){

[...]

--
Rob
Aug 2 '05 #3
RobG <rg***@iinet.ne t.auau> wrote in news:42ef797f$0 $11941$5a62ac22 @per-
qv1-newsreader-01.iinet.net.au :
Language is depreciated, type is required.
<script type="text/javascript">

[...]

if ( 'W' == themethod || 'M' == themethod ){

Thank you very much for this.
btw .. I meant evaluation, and will use your technique from now on.
Aug 2 '05 #4
> Got it ...
I needed <\/script>


JSLint catches problems like that.

http://www.JSLint.com
Aug 2 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3394
by: Blue® | last post by:
I would like to call the content of content.htm (containing only HTML codes) into index.htm. This is usually done by renaming index.htm to index.shtml and use this tag: <!--#include file="content.htm" --> But I do not want to use SSI. Is it possible to call it using something like:
5
2499
by: batham | last post by:
Hi Gurus, How can I execute a script during runtime. Here is my code, so how do I execute the new script during runtime which should be a part of the 'topDiv'. Thanks Help is appreciated. - Shailendra ------- CODE ----------------
9
1714
by: sam.s.kong | last post by:
Hello! I have a JavaScript code like the following. <script> var s = "</script>"; ....
21
8522
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript" src="NO JAVASCRIPT CAN BE USED HERE" /> So I am see'g If I can use eval todo something what I am doing I have tried almost everything, following is being last one
12
62904
by: Iddo | last post by:
Hi, I am having a strange problem... I have an HTML file which has 2 script tags: 1) <script language="javascript" id="ABC" src="ABC.js" /> 2) <script id="general" language="javascript"> function foo() { alert("aaa"); } </script>
44
2818
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
2
2964
by: bilaribilari | last post by:
Hi all, I am using Tidy (C) for parsing html pages. I encountered a page that has some script as follows: <script> .... var abc = "<script>some stuff here</" + "script>"; .... </script>
2
2052
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! Error: BC30456: 'Read_DOM' is not a member of
0
8403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8316
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8737
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.