JavaScript - Put Inline Javascript In The Head
Hi,
The following code works: Code: <html> <head> <style type="text/css"> img { opacity:0.4; filter:alpha(opacity=40); } </style> </head> <body> <img src="http://www.w3schools.com/Css/klematis.jpg" width="150" height="113" alt="klematis" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" /> <img src="http://www.w3schools.com/Css/klematis2.jpg" width="150" height="113" alt="klematis" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" /> </body> </html> But the problem is you have to repeat the inline JavaScript for all <img> tags. I tried to put the script in the head to no avail: Code: <html> <head> <style type="text/css"> img { opacity:0.4; filter:alpha(opacity=40); } </style> <script type="text/javascript"> function getElements() { var x=document.getElementsByTagName("img"); x.style.opacity=1; x.filters.alpha.opacity=100; } </script> </head> <body> <img src="http://www.w3schools.com/Css/klematis.jpg" width="150" height="113" alt="klematis" onmouseover="getElements()" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" /> <img src="http://www.w3schools.com/Css/klematis2.jpg" width="150" height="113" alt="klematis" onmouseover="getElements()" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" /> </body> </html> Everything seems right to me, but it doesn't work. Many thanks for any help! Mike Similar Tutorialscan I use javascipt to put in perl <head> for description. what I want to do is something like this <head> <script type="text/javascript"> if $description != (not == to)" " { <meta name="description" content=" $description"> } else { <meta name="description" content=" my site"> } </scipt> </head> <body> run the java script </body> thanks. I am trying something like Code: <script type=\"text/javascript\"> var description == \"mysite\"; if(description != \"$description\"){ document.write(\"<meta name=\"description\" content=\"mysite\">\"); }else{ document.write(\"<meta name=\"description\" content=\"$description\">\"); } </script> On one of my pages, I have a dropdown menu as well as a image rotator. The problem is that when I have the menu on a page by itself, it loads like this: Not only does it have arrows, it also loads with a fade in/out. This is what I want. However, when both menu and image rotator scripts are in the head, this is the result: it doesnt have the arrows and doesnt fade in/out. Could someone point out where the two scripts come into conflict and possibly a resolution? Here is the code in the head: Code: <!--main stylesheet--> <link rel="stylesheet" type="text/css" href="css/main.css"> <!--menu stylesheets--> <link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen"> <script type="text/javascript" src="js/jquery-1.2.6.min.js"></script> <script type="text/javascript" src="js/hoverIntent.js"></script> <script type="text/javascript" src="js/superfish.js"></script> <script type="text/javascript"> // initialise plugins $(document).ready(function(){ $("ul.sf-menu").superfish(); }); </script> <!--Orbit stylesheets--> <!-- Use the ID of your slider here to avoid the flash of unstyled content --> <style type="text/css"> #featured { width: 940px; height: 450px; background: #009cff url('orbit/loading.gif') no-repeat center center; overflow: hidden; } </style> <link rel="stylesheet" href="orbit.css"> <!--[if IE]> <style type="text/css"> .timer { display: none !important; } div.caption { background:transparent; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000); zoom: 1; } </style> <![endif]--> <!-- Attach necessary scripts --> <script type="text/javascript" src="js/jquery-1.4.1.min.js"></script> <script type="text/javascript" src="js/jquery.orbit.min.js"></script> <!-- Run the plugin --> <script type="text/javascript"> $(window).load(function() { $('#featured').orbit({ 'bullets': true, 'timer' : true, 'animation' : 'horizontal-slide' }); }); </script> I have following HTML code: Quote: <br/> <div style="display:none">.....</div> <div style="display:none">.....</div> How can I modify display to block in style attribute with Javascript? I wrote the code below to practice getting divs to appear and disappear. It has 2 divs. The first div contains two links. One link is to hide the second div, the other link is to make it reappear. I have styles in the head, and 1 inline for each div. Javascript is supposed to change the inline style display value from block to none on the click. The problem is, when I change the value in blue from block to none manually on the server, the change happens successfully and stays in place until I change it back manually. But when I click on the Hide Schedule link, that means I'm telling javascript to change the inline value block to none (highlighted in red in the javascript function), to make the second div disappear. onClick, it disappears for a fraction of a second, then reappears just as it was before the I clicked the link. I haven't clicked the other link, because the div that is supposed to vanish does so for only a split second. It looks like javascript isn't working right. I use firefox. Does anyone know what is going on? Thanks Code: <!DOCTYPE html> <xhtml> <head> <title>Practice Calendar</title> <style type="text/css"> .practicecalendar { float: left margin: 0; width: 18em; background: #eee; text-align: center; } .practiceschedule { float: right; margin: 0; width: 18em; background: #99E6FF; text-align: center; } </style> <script type="text/javascript"> <!-- function showSchedule(){ document.getElementById("practiceschedule").style.display = 'block'; } function hideSchedule(){ document.getElementById("practiceschedule").style.display = ' none '; } //--> </script> </head> <body> <div id='practicecalendar' class='practicecalendar' style=' display: block; '> <p><a href='' onClick='showSchedule()'>Show Schedule</a></p> <p><a href='' onClick='hideSchedule()'>Hide Schedule</a></p> </div> <div id='practiceschedule' class='practiceschedule' style=' display: block ; '> <p><a href='' onClick='showCalendar()'>Schedule</a></p> </div> </body> </xhtml> URL: https://medicard1.com/services.html Site also employs CodeIgniter from original developer. Code below sets up a table with a form and script in separate cells of the same row. Looks good and click on check box works ok, but script seems to only run when the page is initially loaded. Does not change variable 'c' and display the change. Am in a bind for this one. My developer is away for the holiday and CEO wants it done ASAP. Anyone have an idea? <!-- Setup a table to hold the elements where I want them without conflicting with CodeIgniter - K.I.S.S.--> <table style="border:0px;"> <tr> <td style="width:600px; text-align:left;"> <!-- Un-submitted form with legend and checkbox input to acknowledge terms and display discount code --> <form name="acknowledge" action="" method=""> <legend>I acknowledge that I have read and understand the content of this page <!-- onClick should execute display_code() script --> <input style="border:0px; width:40px;" type="checkbox" name="investor" onClick="display_code()"/> </legend> </form> </td> <td style="width:200px; text-align:right;"> <!-- Script should check checked state of checkbox investor and set c to appropriate value --> <script type="text/javascript"> <!-- set c="" after get this working --> var c="NOT SET"; function display_code() { if (document.acknowledge.investor.checked) { var c="INVESTOR"; } else { <!-- set c="" after get this working --> var c="NO CODE"; } } document.write('Your code is: ' + c); </script> </td> </tr> </table> How does one get inline styles placed by javascript to work in Google Chrome? Works in Firefox and Opera, I know that Chrome is receiving the correct data by using alerts, but it is not putting the style object in the HTML.
Is there a way to load up an external JS file outside of the head tag? I've got an "AJAX" web app that's loading several pages simply by changing the innerHTML property of a single div. The JS source is getting to be rather large, so I'd like to split it up into manageable, organized portions. Is there some way to, using javascript or PHP, load another javascript into the browser dynamically?
Hello All, I am having a few issues. I have added a piece of code in and it doesn't seem to be working. I have highlighted this in bold. Any Ideas? <html> <body> <SCRIPT LANGUAGE="JavaScript"> <head> <TITLE>Find the Correct Number Game</TITLE> </head> a=(prompt('please enter your name:',0)); // prompt for player name document.write(' Hello ' ,a); var guessme=Math.round(Math.random()*(49)+1); var speech='Choose a number between 1 and 50'; function process(hiddennumber) { var guessnumber=document.forms.guesstable.guessnumber.value; var speech='"'+guessnumber+ '" Letters are not allowed. Please enter digits only!.'; document.forms.guesstable.guessnumber.value=''; if (guessnumber==hiddennumber) { document.forms.guesstable.prompt.value='Congratulations! '+hiddennumber+' is correct!'; alert ('Well done - the mystery number is '+hiddennumber+'! \n\nIf you want to play again click the button.'); speech=''; document.location=document.location; } if (hiddennumber<guessnumber) { speech='Less than '+ guessnumber; } if (hiddennumber>guessnumber) { speech='Greater than '+ guessnumber; } if (guessnumber=='') { speech='You didn\'t guess anything!' } document.forms.guesstable.prompt.value=speech; document.forms.guesstable.guessnumber.focus(); } </SCRIPT> </body> </html> <FORM onSubmit="" NAME="guesstable"> <CENTER> <TABLE ALIGN="left" BGCOLOR="#888889" BORDER="5" CELLPADDING="5"> <TR> <TD BGCOLOR="#004081"> <FONT COLOR="#ffffff" FACE="Arial"><B>Find the Correct Number</B></FONT> </TD> </TR> <TR> <TD> <CENTER> <INPUT TYPE="text" NAME="prompt" SIZE="31" MAXLENGTH="60" VALUE="Find the correct number which is between 1 and 50"><BR> <INPUT TYPE="text" NAME="guessnumber" SIZE="3" MAXLENGTH="3" VALUE=""> <INPUT TYPE="button" VALUE="Enter" onClick='process(guessme)'> </CENTER> </TD> </TR> </TABLE> </CENTER> </FORM> http://www.masterclock.com/newContac...help/david.php I have a page with 3 forms. I've got javascript making them appear and disappear with buttons at the top. I mostly copied this guy's form: http://tetlaw.id.au/view/javascript/...eld-validation I added some conditional checkboxes using wform javascript library. my problem is that i need my reset button to a)reset the fields and b)re-hide the conditional fields. It works with the sales form and the catalog form (the catalog from doesn't use the conditional fields) but for some reason the request a quote form is convinced .request isn't a function. Even though it is using the same function as the sales form only it is pushing it's form id to it. what the heck am i doing wrong? And how awful and waste of space is my code? I am very new to learning JavaScript and I already seem to have come across a problem. I can get Scripts to work fine in the <body> but not all scripts seem to work in the <head> For example, this works fine: Code: <html> <body> <p id="date"></p> <script type="text/javascript"> <!-- document.getElementById('date').innerHTML = Date(); //--> </script> </body> </html> However, it won't work if I place the script in the head like this: Code: <html> <head> <script type="text/javascript"> <!-- document.getElementById('date').innerHTML = Date(); //--> </script> </head> <body> <p id="date"></p> </body> </html> It could just be that I broke one of the fundamental laws of coding that I don't know or something but like I said, I've only just started JavaScript. Also, the tutorial I have isn't to clear on the differences between using the <head> or the <body>. Just kinda says you can do both. I'd like to use the <head> wherever possible because it would be so much neater to keep all the JavaScript in one place and all the HTML in another. Pretty much like you can do with CSS. Anyway, I'd be much grateful if somebody can explain this to me. Hello, I am new here. I am having problems with a talking head video on my website www.getvms.com. A young woman pops up and speaks and then when you click on her a form to fill out is supposed to pop up. It works perfect in chrome and FF, but in IE the video just closes. Can someone tell me why that is? Or at least some type of direction? I found that when the script is in there twice it works, but of course that cause the video to echo. Here is the code for the page.... Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta name="verify-v1" content="+E5zkaC6JxDkzTZkPgdW9Gmj8aIXPzDPpIpeBsUDi0s=" > <title>VMS - Velocity Merchant Services - Downers Grove, IL</title><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="description" content="Velocity Merchant Services of Downers Grove, IL offers credit card processing for Visa, MasterCard, American Express, and Discover allowing businesses to accept credit cards and debit cards."> <meta name="keywords" content="VMS, Velocity Merchant Services, Credit Card Terminals, Downers Grove Merchant Services, Oakbrook Merchant Services, Accept Credit Cards, Accept Debit Cards, Credit Card Processing, Merchant Service Provider, Merchant Card Services, Downers Grove Business Service, Oakbrook Business Service"> <meta http-equiv="content-language" content="en-us"> <meta name="robots" content="index,follow"> <meta name="googlebot" content="index, follow"> <meta name="revisit-after" content="10 days"> <meta name="author" content="Velocity Merchant Services - VMS"> <link href="style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="menu/imenus0.css" type="text/css"> <link rel="stylesheet" href="cssverticalmenu.css" type="text/css"> <script src="swfobject.js" type="text/javascript"></script> <link rel="icon" href="/favicon.ico" type="image/x-icon"> </head> <body> <div id="container"> <div id="logo"><img src="images/logo.gif" alt="Logo"></div> <table width="781" border="0" align="center" cellpadding="0" cellspacing="0" style=" margin-top:10px; background:url(images/nav-bkgd.gif) no-repeat center top;"> <tr> <td><script language="JavaScript" src="menu/imenus0.js" type="text/javascript"></script></td> </tr> </table> <table width="781" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="781" colspan="3"> <div id="flasher"><img src="images/photo-home.jpg" alt="Velocity Merchant Services" width="781" height="164"></div> <script type="text/javascript"> var so = new SWFObject("flash_final.swf", "flash_content", "781", "222", "8"); so.addParam("wmode","transparent"); so.write("flasher"); </script></td> </tr> </table> <table width="781" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td width="381" valign="top"><a href="about.html" onMouseOver="Tip('<b>Phone:</b> <br> (888) 902.6227 <br> <br> <b>Address:</b> <br> Velocity Merchant Services <br> 3051 Oak Grove Dr. (Second Floor) <br> Downers Grove, IL 60515')"> <h3> Welcome To Velocity Merchant Services </h3> Velocity Merchant Services </a> is a direct processor for Visa, MasterCard, American Express and Discover. Offering multiple payment options for your customers is the first step to increasing your company's cash flow.</p> <p>At VMS we will not only approve you to accept credit cards and debit cards from your customer; but we will help implement proven marketing strategies to help your business grow!<span class="style1"><br> </span></p> </td><td width="380" valign="top"><h3> Are You PCI Compliant?</h3> <P>Make sure your business is compliant with the latest PCI (Payment Card Industry) Data Security Standards to ensure your customers' confidential information is trasmitted in the most secure environment possible. <a href="/pci">Take our quick survey</a> and avoid non-compliance penalties.</P> <P><a href="/pci"><u>Take The PCI Compliance Survey</u></a>!</P> </td> </tr> <tr> <td colspan="2" valign="top"> </td> </tr> </table> <table width="781" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="196" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="agent-services.html">Agent Services</a></h2></td> </tr> <tr> <td valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="become-a-partner.html">Become a Partner</a></li> <li><a href="value-added-services.html">Programs & Services</a></li> <li><a href="login.html">ISO Sales Agent Sign Up</a></li> <li><a href="news.html">News</a></li> <li><a href="resource-center.html">Resource Center</a></li> <li><a href="careers.html">Careers</a></li> </ul> </div> </td> </tr> </table> </td> <td width="195" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="existing-merchants.html">Existing Merchants</a></h2></td> </tr> <tr> <td align="center" valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="service-upgrade.html">Service Upgrades / Additions</a></li> <li class="list-spacing"><a href="customer-service.html">Tech Support / Customer Service</a></li> <li><a href="order-free-supplies.html">Order Free Supplies</a></li> <li><a href="american-express-card.html">American Express Card</a></li> <li><a href="referralprogram.html">Referrals</a></li> <li><a href="faq.html">FAQ's</a></li> </ul> </div></td> </tr> </table></td> <td width="195" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="value-added-services.html">Value Added Services</a></h2></td> </tr> <tr> <td align="center" valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="vms-fast-cash.html">Cash Advances</a></li> <li><a href="gift-cards.html">Gift Cards</a></li> <li><a href="web-development.html">Web Development</a></li> <li><a href="check-services.html">Guarantee Check Service</a></li> <li><a href="eletronic-benefits-transfer.html">Electronic Benefit Transfer</a></li> <li><a href="business-cards.html">Business Cards</a></li> <li><a href="http://www.getvms.com/icharge/">iCharge</a></li> </ul> </div></td> </tr> </table></td> <td width="195" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="merchant-services.html">Merchant Services</a> </h2></td> </tr> <tr> <td align="center" valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="retail.html">Retail</a></li> <li><a href="restaurant.html">Restaurant</a></li> <li><a href="health-pharmaceuticals.html">Health/Pharmaceuticals</a></li> <li><a href="service.html">Service</a></li> <li><a href="mail-order.html">Mail Order / Telephone Order</a></li> <li><a href="ecommerce.html">eCommerce</a></li> </ul> </div></td> </tr> </table></td> </tr> </table> <br> <table width="781" border="0" align="center" cellpadding="20" cellspacing="0" style="background-image:url(images/footer-bkgd.gif); background-repeat:no-repeat" id="footer"> <tr> <td width="541" align="center" valign="middle"><p><a href="index.html">Home</a> :: <a href="about.html">About VMS</a> :: <a href="merchant-services.html">Merchant Services</a> :: <a href="web-development.html">Web Development</a> :: <a href="vms-fast-cash.html">Cash Advances</a><br> <a href="credit-card-terminals.html">Credit Card Terminals</a> :: <a href="request-information.php">Request Info</a> ::<a href="contact.html"> Contact</a> :: <a href="privacy-policy.html">Privacy Policy</a></p> <p>© 2010 Velocity Merchant Services. VMS is a registered ISO and MSP of HSBC Bank, USA<br> National Association, Buffalo, NY</p></td> <td width="160" align="center" valign="middle"><p>Velocity Merchant Services<br> 3051 Oak Grove Road<br> Downers Grove, IL 60515<br> Phone: (888) 902.6227<br> Fax: (888) 902.6229</p></td> </tr> </table> <br> <table align="center" width="781" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"><a href="application.php"><img src="images/creditcards.jpg" alt="Apply Now!" border="0"></a></td> </tr> </table> <p> </p></td> <td align="right"><table border="0" cellspacing="0" cellpadding="0"> <tr> <td><a rel="nofollow" target="_blank" href="http://www.bbbonline.org/cks.asp?id=1061023114246"><img src="images/bbb.gif" alt="Click to verify BBB accreditation and to see a BBB report." width="40" height="64" border="0" title="Click to verify BBB accreditation and to see a BBB report."></a></td> <td style="padding: 0 15px"><a href="http://www.uschamber.com/sb" rel="nofollow" target="_blank"><img src="http://www.uschamber.com/sb/websticker/image.asp?i=a2&m=999999" alt="U.S. Chamber of Commerce Member 2008" hspace="10" title="U.S. Chamber of Commerce Member 2008"></a></td> <td><script type="text/javascript" src="http://sealserver.trustkeeper.net/compliance/seal_js.php?code=w6otlmrNfNOhkhjNVXmBsFWOX2IVM8&style=normal&size=105x54&language=en"></script> <noscript> <a href="https://sealserver.trustkeeper.net/compliance/cert.php?code=w6otlmrNfNOhkhjNVXmBsFWOX2IVM8&style=normal&size=105x54&language=en" rel="nofollow" target="hATW"><img src="http://sealserver.trustkeeper.net/compliance/seal.php?code=w6otlmrNfNOhkhjNVXmBsFWOX2IVM8&style=normal&size=105x54&language=en" alt="Trusted Commerce" border="0"></a> </noscript></td> <td width="179"> <a href="docs/ViewComplianceCertificate.action.pdf" rel="nofollow" target="_blank"><img src="images/compliance%20icon.jpg" width="175" height="74" border="0" align="right" alt="Compliance"></a></td> </tr> </table> <table align="right"><tr><td><p> <!-- <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> </a>--> </p></td><td> <p> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88" border="0"></a>--> </p></td></tr></table> </td> </tr> </table> <script language="JavaScript" src="menu/ocscript.js" type="text/javascript"></script> <script language="JavaScript" src="wz_tooltip.js" type="text/javascript"></script> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-4568625-2"); pageTracker._initData(); pageTracker._trackPageview(); </script> <script language="javascript" type="text/javascript" src="wthvideo/wthvideo.js"></script> </div> </body> </html> for the javascript.... Code: // Copyright 2010 Website Talking Heads // JavaScript Document if (typeof wthvideo == 'undefined') { wthvideo = new Object(); } wthvideo.params = { width:272, height:384, position:"fixed", doctype:"strict", left:"auto", right:"0px", top:"auto", bottom:"0px", centeroffset:"auto", color:0x022918, volume:70, autostart:"yes", fadein:1, fadeout:2, delay:0, delayclose:5, buffertime:3, playbtn:"PlayVideo.png", playposition:"right", playtop:"bottom", exitoncomplete:"yes", oncepersession:"no", vidlink:"http://www.getvms.com/request-information.php", openin:"_blank", path:"wthvideo", actorpic:"rennygetvms3410.png", flv:"rennygetvms3410.flv" }; var topPx = parseFloat(wthvideo.params.top); var bottomPx = parseFloat(wthvideo.params.bottom); wthvideo.hideDiv = function(){ document.getElementById('wthvideo').style.visibility = 'hidden'; } function onlyOnce() { if (document.cookie.indexOf("hasSeen=true") == -1) { var later = new Date(); later.setFullYear(later.getFullYear()+10); document.cookie = 'hasSeen=true;path=/;'; wthvideo.drawVideo(); } } if (navigator.appName.indexOf("Microsoft") != -1) { var topWth = 577; } else { var topWth = 582; } wthvideo.drawVideo= function(){ var markUp = ''; markUp += '<style type="text/css">'; markUp += '#wthvideo {position:'+wthvideo.params.position+';width:'+wthvideo.params.width+'px;height:'+wthvideo.params.height+'px;margin-left:'+wthvideo.params.centeroffset+';left:'+wthvideo.params.left+';right:'+wthvideo.params.right+';top:'+wthvideo.params.top+';bottom:'+wthvideo.params.bottom+';z-index:99999999999;}'; markUp += '</style>'; markUp += '<div id="wthvideo">'; markUp += ' <object id="objvideo" style="outline:none;" type="application/x-shockwave-flash" width="'+wthvideo.params.width+'" height="'+wthvideo.params.height+'" data="'+wthvideo.params.path+'/wthplayer.swf">'; markUp += ' <param name="movie" value="'+wthvideo.params.path+'/wthplayer.swf" />'; markUp += ' <param name="quality" value="high" />'; markUp += ' <param name="flashvars" value="vurl='+wthvideo.params.flv+'&vwidth='+wthvideo.params.width+'&vheight='+wthvideo.params.height+'&actorpic='+wthvideo.params.path+'/'+wthvideo.params.actorpic+'&autostart='+wthvideo.params.autostart+'&exitoncomplete='+wthvideo.params.exitoncomplete+'&vbuff='+wthvideo.params.buffertime+'&vdelay='+wthvideo.params.delay+'&vcolor='+wthvideo.params.color+'&vlink='+wthvideo.params.vidlink+'&openin='+wthvideo.params.openin+'&delayclose='+wthvideo.params.delayclose+'&fadein='+wthvideo.params.fadein+'&fadeout='+wthvideo.params.fadeout+'&vvol='+wthvideo.params.volume+'&playbtn='+wthvideo.params.path+'/'+wthvideo.params.playbtn+'&playpos='+wthvideo.params.playposition+'&playtop='+wthvideo.params.playtop+'" />'; markUp += ' <param name="wmode" value="transparent" />'; markUp += ' <param name="allowscriptaccess" value="always" />'; markUp += ' <param name="swfversion" value="9.0.45.0" />'; markUp += ' </object>'; markUp += '</div>'; markUp += '<div id="highlightWth" style="position:absolute; width:150px; height:30px; left:50%; top:'+topWth+'px; visibility:hidden">'; markUp += '<img src="wthvideo/orangecircledrawn.png">'; markUp += '</div>'; if (wthvideo.params.position == "fixed") { if (wthvideo.params.doctype == "quirks") { if (wthvideo.params.top == "auto") { markUp += '<!--[if IE]>'; markUp += '<style type="text/css">'; markUp += '#wthvideo {position:absolute; top: expression(offsetParent.scrollTop - 1 + (offsetParent.clientHeight-this.clientHeight) + '+bottomPx+' + "px")}'; markUp += '</style>'; markUp += '<![endif]-->';} else { markUp += '<!--[if IE]>'; markUp += '<style type="text/css">'; markUp += '#wthvideo {position: absolute !important;top: expression(((document.documentElement.scrollTop || document.body.scrollTop) + (!this.offsetHeight && 0)) + '+topPx+' + "px")'; markUp += '</style>'; markUp += '<![endif]-->';} } else { markUp += '<!--[if lte IE 6]>'; markUp += '<style type="text/css">'; markUp += 'html, body{height: 100%;overflow: auto;}#wthvideo {position: absolute;}'; markUp += '</style>'; markUp += '<![endif]-->'; } } document.write(markUp); } function hideDiv() { wthvideo.hideDiv(); } if (wthvideo.params.oncepersession == "yes") { onlyOnce();} else { wthvideo.drawVideo(); } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName]; } else { return document[movieName]; } } function cue0Bright() { document.getElementById('highlightWth').style.visibility = 'visible'; } function cue0Normal() { document.getElementById('highlightWth').style.visibility = 'hidden'; } function cue0() { cue0Bright(); setTimeout("cue0Normal();", 3000); } function cue1Bright() { document.getElementById('highlightWth').style.visibility = 'visible'; document.getElementById('highlightWth').style.top = topWth+38+'px'; } function cue1Normal() { document.getElementById('highlightWth').style.visibility = 'hidden'; } function cue1() { cue1Bright(); setTimeout("cue1Normal();", 1500); } function cue2Bright() { document.getElementById('highlightWth').style.visibility = 'visible'; document.getElementById('highlightWth').style.top = topWth+19+'px'; } function cue2Normal() { document.getElementById('highlightWth').style.visibility = 'hidden'; } function cue2() { cue2Bright(); setTimeout("cue2Normal();", 4000); } I need to get this figured out fairly quickly. As I said the pop-ups work in FF and Chrome, but in IE the program just closes. Hello and thanks for letting me on this forum! Im pretty new to JScript and I am still getting used to it all. I am trying to make a Website that allows values to be selected from one form, transferred to the next form as a summary and then completed. The values are sent to the page fine but my Validation is broken. Here is my LINK code In the Form Code: <form id="Tickets" onsubmit="return ValidateForm()" action="Details.html"> And in the Submit Button Code: <input type="submit" id="OrderTickets" value="Order Tickets" onclick="return ValidateForm()" > My validation is as follows Code: <script type = "text/javascript"> function ValidateForm() { if( document.getElementById('DepartingStation').selectedIndex == " ") { alert( "Please provide a Departing Station!" ); document.getElementById('DepartingStation').focus() ; return false; } if( document.getElementById('ArrivingStation').selectedIndex == " ") { alert( "Please provide an Arriving Station!" ); document.getElementById('ArrivingStation').focus() ; return false; } var Depart = document.getElementById('DepartingStation').value; var Arriv = document.getElementById('ArrivingStation').value; if( Depart==Arriv){ alert( "Train cannot depart and arrive at the same station!" ); return false; } if ( document.getElementById('ReturnTravel').checked=true; { var valueDate = document.getElementById('OutwardDate').value; if ( valueDate== null || valueDate== '') { alert('Please provide an Outward Travel Date!'); return false; } } var valueRetDate = document.getElementById('ReturnDate').value; if ( document.getElementById('ReturnTravelType').checked==true && (valueRetDate== null || valueRetDate== '' )) { alert('Please provide a Return Travel Date!'); return false; } } Id appreciate any help anyone can share on this! Thanks. I have an external .js file that ends its process with a document.write() command. This needs to be called near the end of the HTML page, right before </body>. Am I better off calling the external .js at the desired location in the footer? Or making the .js into a defined function, loading the .js in the <head> portion and then executing the function in the footer? - M. This is really annyoing. I'm trying to set up an image's source from a function within the document's head, but to no avail. The code is something like this: ------------------------------------------------------- <head> .....js code..... function updatePieChart() { document.pie_chart.src = "piechart.php?p1&p2"; // php-generated image, with parameters } // A FUNCTION WHICH SUCCESSFULLY RUNS EVERY 2-3 SECONDS function ajax() { ....stuff..... // THE NEXT LINE DOESN'T WORK!!! // updatePieChart(); ...stuff..... } ....js code...... // THE NEXT LINE DOESN'T WORK!!! // updatePieChart(); </head> //THIS LINE WORKS LIKE A CHARM <body onload="updatePieChart();"> ....bla bla bla... <img src="#" name="pie_chart" /> ...bla bla bla.... </body> ------------------------------------------------------- As you can see, the function updatePieChart works wonderfully from the <body> tag of the function, but any attempt to call it from within the <head> tags fails. Also, I've tried to change the function updatePieChart so that it wouldn't call any php code and changed it to a simple document.pie_chart.src = "#"; but that still causes errors on the page when called from inside the <head> tags. On the other hand, if the function updatePieChart merely made an alert() call, then the ajax element works fine, and every so and so seconds I get an alert. Anyone, help? An explanation how come I can't set the image from within the <head> tags? I want to use some scripts from http://www.dynamicdrive.com Most of them require pasting script in both the HEAD and BODY of the page. Now, the way my WordPress is set up (Egesto theme), is in individual pages, which I cannot find any way to edit their HEAD or BODY. The only HEAD and BODY sections I see are in the Editor section, where I can edit the overall header.php, but that effects every page, I think. Anyways, does anyone know how I can solve this? Thank you. I want to insert a link into an email that opens a new window of a specific size. All of the scripts I find require some code to be inserted into the <head> tag of the page. Obviously this will not work since I am inserting the link into an email. Is there a JavaScript code for opening a popup window that's not dependent on <head> code?
I need the index of an element in a numeric array. I have tried several variations, but all of them return a undefined value. I can look at the dom and see that the value is there, but the code isn't finding it, please help. Code: Array.prototype.indexValue =function (s){ var index = 'It is not here'; for (var i=0; i<orderArray.lenght; i++){ if (orderArray[i] == s){ return i; } } return index; } function move(){ //get the array posstion of the page in the order array var gpid = 38; var num = orderArray.indexValue(gpid); alert(num); } var orderArray=[28,32,38,45,65]; For me, every time it returns, "It is not here". Help. TIA, Adam How to: pass local variable from <head> JS function to <body> textarea I have a JS function in the head that calculates a variable. the function is triggered by the vevent of a button click. when calculation is done, how is it sent back to the page and placed in a textarea or textbox....?? /Beginner issues :/ i have some really annoying issues with a widget which is known inline modal you can see that widget after you click the play button in the given link below, please help me out, the issue is that use google chrome and then go to this place, the link is: http://www.bloghuts.com/2010/09/star-island.html and in this page click on play, then you yourself will see the error, please tell me what to do with this error. And another problem is that again open the above link in internet explorer and click the play button you will see a different kind of annoying problem, except these two explorers it works fine, PLEASE HELP ME I WOULD REALLY BE THANKFUL TO YOU. Hi i have some inline code that i would prefer to transfer into javascript functions and place in a .js file in the head or foot of my webpage. I have tried to convert into funtions myself but could not get to work. Would appreciate any help to give me the correct working code. thanks. Here is the portion of code from inside a working form: <button id="decbtn" onclick="updbtn.style.background='url(images/wuc.gif)';qty.style.background='';decrement(this.parentNode.getElementsByTagName('input')[0]);return false;">-1</button> <input id="qtyinp" name="qty" onkeyup="updbtn.style.background='url(images/wuc.gif)';qty.style.background='url(images/packindic.png) no-repeat bottom right #ffffff';this.value=this.value.replace(/[^\d]/,'');return false;" maxlength="3" value="0" type="text"> <button id="incbtn" onclick="updbtn.style.background='url(images/wuc.gif)';qty.style.background='';increment(this.parentNode.getElementsByTagName('input')[0]);return false;">+1</button> <input name="pid" value="A0517A" type="hidden"> <button id="updbtn" type="submit" onclick="this.style.background='';qty.style.background='url(images/upd.png) no-repeat right top #ffffff';">Update</button> |