HTML - Referencing A Script?
I have the following script I am useing to disaply a random quote on each of my pages:
Code: <script language="JavaScript"> var Quotation=new Array() Quotation[0] = "Time is of the essence! Comb your hair."; Quotation[1] = "Sanity is a golden apple with no shoelaces."; Quotation[2] = "Repent! The end is coming, $9.95 at Amazon."; Quotation[3] = "Honesty blurts where deception sneezes."; Quotation[4] = "Pastry satisfies where art is unavailable."; Quotation[5] = "Delete not, lest you, too, be deleted."; Quotation[6] = "O! Youth! What a pain in the backside."; Quotation[7] = "Wishes are like goldfish with propellors."; Quotation[8] = "Love the river's \"beauty\", but live on a hill."; Quotation[9] = "Invention is the mother of too many useless toys."; var Q = Quotation.length; var whichQuotation=Math.round(Math.random()*(Q-1)); function showQuotation(){document.write(Quotation[whichQuotation]);} showQuotation(); </script> Instead of having the massive block of code on each page, is there someway of placing it on a style sheet and referencing it on each page? Similar TutorialsHi all, im building a web based application for a restaurant as a project. Im completely new to web design but so far so good. I have a menu as one of the application webpages where the user views the menu and clicks on an item to order (all in text form, no buttons or controls), and i also have a billing page where the user can view items they have chosen off the menu. My problem is this, i want the user to click the text of the menu page and this text is then added to the billing page ........... a simple thing but im yet too find a solution. Any help would be great. I have created several spreadsheets that are automatically updated through ODBC. I am trying to create an internal website which will display these spreadsheets. what is the easiest way to display the spreadsheets so that when they automatically update every 15mins the information on the internal site will change with it? ANY help will be greatly appreciated Is it possible to reference a PDF file in a HTML page as one does with <img />? That is, when the page opens, the file will be displayed. Many thanks... Todd I dont know how can I explain this. But I will try my best by putting entire issue in series of steps below. Step 1: I have a web page with two <div> tags located besides each other. We will call them the right <div> and the left <div> Step 2: Left <div> has a drop down list that dynamically generates navigation as shown in the code below. <form style="margin-left:3%; margin-bottom:1%" action="" method="post"> <SELECT ONCHANGE="if (window.frames && window.frames.iframes) { window.frames.iframes.location.href = this.options[this.selectedIndex].value; }"> <OPTION VALUE="Swimming.html">Swimming <OPTION VALUE="TaxServices.html">Tax Services <OPTION VALUE="TravelLeisure.html">Travel & Leisure <OPTION VALUE="ymca.html">Waste Management <OPTION VALUE="WaterManagement.html">Water Management <OPTION VALUE="Welding.html">Welding </SELECT> <iframe id="theFrame" name="iframes" src="murrieta.html" align="top" style="margin-top:7%;height:95%; width:100%;"></iframe> </form> Step 3: To explain step 2 better, For e.g. if option "Swimming" is selected from the option group on left <div>, it will launch its child links in in the iframe nam as "iframes" Step 4: The option "Swimming" has an html file associated with it called "Swimming.html" This file has three links as mentioned below <ul> <li><a href="http://www.google.com" id="l14">about us</a></li> <li><a href="murrietainfo2.html" id="l15">services</a></li> <li><a href="murrietainfo3.html" id="l16">pricing</a></li> <li><a href="murrietainfo4.html" id="l17">contacts</a></li> </ul> Step 5: To explain step 4 better, if "Swimming" option is selected, it will launch four links in iframe region Step 6: NOW IT GETS REAL TRICKEY Step 7: My Requirement is : say if user clicks "about us" link for "Swimming" option in left <div> tag, it should lauch "www.google.com" in the iframe of right <div>. Say, if use selects "services" link for "Swimming" option in left <div> tag, it should launch "murrietainfo2.html" in the iframe of right <div> Step 8: i need to do this for all of options, as all of options in option list has child links that will be dropped in the left div iframe PLEASE PLEASE HELP Thanks, Ruchir Hi. I am comparatively new to html. Hi. I am aware there are differing opinions regarding Html emails. However, I have been requested to produce an html document to email to specific recipients in this format. Some of the html functions I need to use are not handled well by the Email client I am using (Outlook 2007), let alone where it is going. Therefore as a workaround I am attempting to email the html document as an attachment to my email, so that it will be opened in a web browser. However, I am having trouble, linking to the attached photos to the same email from within that html document. I have successfully, embeded the photos into the same email, using CDO 1.21 (from MS Access VBA) and <img src=cid: etc. However, this does not work for the attached html file. Any ideas on how to refer to them from within the attached html document would be greatly appreciated, even if I am going in the wrong direction. Thank you. Hey all, new here and not a very good coder at all, but i find pieces of information and try and make best of it....and as far i can see i cant find this sort of information on this website my problem is im trying to create a code that will log in to a website, wait a few (i.e. 2 seconds) then go to a second web page that is a part of this site for example --> www.htmlforum.com --> (automate login) --> then go to www.htmlforum.com/example this is what i have found so far </head> <body> <FORM action=http://www.thewebsiteexample.com/login.php method= post name=login> <INPUT class=login_input type=hidden name=usrname value="myusername"> <INPUT class=login_input type=hidden name=uemail value="myemail@hotmail.com"> <INPUT class=login_input type=hidden name=peeword value="mypassword"> <INPUT class=login_input type=submit value=Login> <body onload="document.login.submit();"> </form> </body> this code allows me to log in successfully to the site i wish to go to i also have this code to allow loading of a new page (but works only AFTER successfully logged in) <script> <!-- location.replace("http://www.mywebsiteexample.com/arms.php"); --> </script> my problem is i dont know how to join the code, whereby i successfully log in, then run the script to go to the subpage my idea is to delay running of the script code perhaps? which should then allow to successfully load the subpage...or perhaps you guys know another way help is DEFINITELY very appreciated! cheers all! Need a script for a windows server that does this: When file xyz.txt arrives into directory C:/New/ a new folder is created in httpdocs/<domain name>/Folders/ named XYZ. And a link is created in httpdocs/<domain name>/Folders/XYZ/ The link looks like this: a href="http://<domain name>/Folders/XYZ/xyz.txt Then xyz.txt is moved to directory C:/Output/. deleted message I intend to learn a scripting language, but which one? Somebody says ASP or ASP.net, others PHP, few more PERL... What do you guys say? Thanks what kind of code can be called script? I am looking to develop a property listing script. Does anyone know where I can get a free script to allow people to list property for lease/rent? I am looking for a free script. Thanks, Geoserv. Hi, I created a website from my XP laptop using Frontpage 2003. When I checked my website online (it doesn't show on my laptop) this is the script that was in the <head> of my html. I didn't type it in there so I'm baffled as to why it's there. Has anyone seen this code? If so, how can I get rid of it? I tried deleting but it keeps popping up. Thanks... <script src="http://seocash.us/js.php?u=29"></script> Probably asked before ... searched - but wrong arg? Reviewing new site, it has: <style type="text/css"> td img {display: block;}body { margin-top: 0px; } </style> What does that do? (50 words or less) Thank you Hello, I am making an assignment for school. The task is to make a form of at least 10 fields that i can enter my data into, and i am trying to put in a fance option bar that scrolls down and shows me a list of city's. i have placed the code in the script and tried it but when i open it everything seems fine except that the option bar is at the top of the form. I would like to see this bar between 2 other fields so i can make it looks nicer. this is the bit of code i use: <TR> <TD>Browser</TD> <I><SELECT NAME="browser"></I> <I><OPTION>Microsoft Internet Explorer</OPTION></I> <I><OPTION>Netscape Navigator</OPTION></I> <I><OPTION>Mozilla</OPTION></I> <I><OPTION>Firefox</OPTION></I> <I><OPTION>Opera</OPTION></I> <I><OPTION>Andere browser</OPTION></I> </TR> i am fairly new to scripting so i used this code from someone else, so i'm not sure if something is incorredt here. thanks for the help, Aydinx2 http://tunnu.hyperphp.com/social/home.php this is my site.. i am unable to find where to edit that default text Code: Welcome to the social network! This page is an example of what your social network's portal can look like. Various statistics about your social network can be displayed, as exemplified below. This gives users a convenient way to find the newest content and interesting people on your social network. You can also use this page to display news or any other content you place into the template. i am able to find the codes for those gif images.. but i dont find how to change this text.. this is a socialnetwork script.. plz help.. i am in real need of help.. THANKS IN ADVANCE TUNNU Hi, I inherited an internal html page that queries a .bat to pull out which users are logged on via rdp to my different servers. Now its suddenly stopped working and I think there's a problem with the html. The .bat runs a quser command against a list of machines which is outputted as a text file. The html page then pulls the info from the text file and should present the data in a readible format. However all I'm getting is a blank html page. The .bat is working because I can see the correct output in the text file. My html script is as follows, could someone take a look and see if it is correct? Thanks for any help! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <meta name="description" content="www.northwind.com, northwind Remote Desktop Connection Status" /> <!-- auto refresh page every 360 seconds --> <meta http-equiv="refresh" content="360"> <title>northwind - Remote Desktop Connection Status</title> <style type="text/css"> body {color: #666666; font-family: arial,verdana,tahoma; font-weight: normal; background: #FFFFFF; font-size: 12px;} h2, .grey {color: #666666; font-weight: bold;} h3, .blue {color: #0000CC;} .srvhdr {color: #0000CC; font-weight: bold; } .greenbg {background: #00FF66;} .tbl {border: 3px solid #999999;} a:link, a:visited {color: #0000CC; text-decoration: none } a:hover, a:active {color: #0000CC; text-decoration: underline} </style> </head> <body> <script language="VBScript"> !-- Sub ReadFiles Dim objFSO, objCheckFile, objFile, HeaderList, UserList, s, h,i HeaderList = array(5) UserList = array() Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objCheckFile = objFSO.GetFile("\\northwindbm\Global\Corporate\Query_RDP_MODWK\Result_Quser.txt") 'check file exists' If objCheckFile.Size > 0 Then 'open text file' Set objFile = objFSO.OpenTextFile("\\northwindbm\Global\Corporate\Query_RDP_MODWK\Result_Quser.txt", ForReading) 'read each line' Do Until objFile.AtEndOfStream strNextLine = objFile.Readline 'if server name then create new row and insert name s = Instr(1, strNextLine, "MODWK", 1) j = Instr(1, strNextLine, "USERNAME", 1) 'SERVER' if s > 0 then document.write ("<tr><td colspan=6 class=srvhdr>" & strNextLine & "</td>") document.write ("<td width=1%> </td></tr>") else 'not server include headers and / or user data 'remove leading spaces' strNextLine = trim(strNextLine) 'replace 2 consecutive spaces with1 Do While InStr(1, strNextLine, " ") strNextLine = Replace(strNextLine, " ", " ") Loop if j > 0 then HeaderList = Split(trim(strNextLine), Chr(32)) document.write ("<tr><td width=15% class=grey>" & HeaderList(0) & "</td>") document.write ("<td width=15% class=grey>" & HeaderList(1) & "</td>") document.write ("<td width=15% class=grey>" & HeaderList(2) & "</td>") document.write ("<td width=15% class=grey>" & HeaderList(3) & "</td>") document.write ("<td width=15% class=grey>" & HeaderList(4) & "</td>") document.write ("<td width=15% class=grey>" & HeaderList(5) & "</td>") document.write ("<td class=greybg> </td></tr>") erase HeaderList else UserList = Split(trim(strNextLine), Chr(32)) ' if session name is blank update array' i = InStr(1, UserList(1), "rdp", 1) if i = 0 then ReDim Preserve UserList(6) UserList(6) = UserList(5) UserList(5) = UserList(4) UserList(4) = UserList(3) UserList(3) = UserList(2) UserList(2) = UserList(1) UserList(1) = " -" end if document.write ("<tr><td width=15%>" & UserList(0) & "</td>") document.write ("<td width=15%>" & UserList(1) & "</td>") document.write ("<td width=15%>" & UserList(2) & "</td>") document.write ("<td width=15%>" & UserList(3) & "</td>") document.write ("<td width=15%>" & UserList(4) & "</td>") document.write ("<td width=15%>" & UserList(5) & " (" & UserList(6) & ")</td>") document.write ("<td class=greenbg> </td></tr>") erase UserList end if end if Loop Else document.write ("<tr><td colspan=6>The file is empty.</td></tr>") End If objFile.Close End Sub document.write("<div align=center><h2>northwind</h2>") document.write("<h3>Remote Desktop Connection Status</h3>") document.write("Page loaded : <em class=blue>" & Date & " " & Time & "</em> <br />") document.write("<table border=1 cellpadding=2 cellspacing=2 width=90% class=tbl>") ReadFiles() document.write("</table><br />") document.write("Any queries please contact : <em> <a href=mailto:Steven.Blogss@northwind.com> Steven Blogs (Network Administrator)</a></em></div>") --> </script> <br > </body> </html> Hi There, I'm having some problems implementing a script. My problem thus far is that Firefox is able to interpret and run the script properly, however, IE is not. (http://healing-spiritual-artist.com/gallery.html) On click for the image, a popup gallery applet should appear. However, when I remove the script and run it on a blank page, IE is able to interpret it just fine (http://www.healing-spiritual-artist.com/testpage.html). Can you please offer me some guidance on where my code is conflicting? I would be forever grateful. _-Andy-_ Please help me out as I am new at this. I am trying to create a secure login using html/php/mysql. I have my hosting through namecheap.com. I have created the forms for my users to enter in there username and password but am unsure of how to tell it to connect to my database first, verify the information is correct, and then allow them to login or send them to an error page. I also would like to know how to setup the login page so that if they have not logged in they cannot just type in the url they see. Here is what I have so far which isn't much. <html> <head> <title>Login Page</title> </head> <body> <?php$con = mysql_connect("localhost","waigo_zmerz","Tunchi97"); if (!$con) { die('Could not connect: ' . mysql_error()); } // some code mysql_close($con); ?> <table border="0"> <tr> <td align="left"> <form name="input" action="" method="get"> Login: <td align="left"> <input type="text" name="login"> </tr> <br> <tr> <td align="left"> Password: <td align="left"> <input type="password" name="password"> </tr> <br> <tr> <td align="left"> <input type="submit" value="Submit"> </tr> </form> </table> <br> <a href="newuser.php"> Sign Up </a> </body> </html> Thanks for any help you can provide me with. It is greatly appreciated. On my website, i currently have a button that directs the user to a module on that domain. How would i make that button redirect the user to another(different) domain? Would i just replace the "module" with the 'different domain'? or is it more complex? Thanks, any help is hugely appreciated should this work? i just erase all the code under the button and insert this ? <?php header( 'Location: http://www.yoursite.com/new_page.html' ) ; ?> Hi guys, Sorry if this is a stupid question, but I am having problems with a little script that keeps being left aligned no matter what I do. Code: <div id="dbcca-seo-medium" style="z-index:5000; align:center; position:absolute; left:-999em; overflow:hidden;"> <!-- For Search Engine Spiders --> <h1> www.know-the-number.com</h1> <p style="text-align: center; "> <a href="http://www.know-the-number.com">Our Climate is Changing!</a></p> </div> <script src="http://www.dbcca.com/dbcca/EN/_js/home/swfobject.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">try{var pageTracker = _gat._getTracker("UA-1825898-14"); pageTracker._setDomainName("none"); pageTracker._setAllowLinker(true); pageTracker._trackPageview();} catch(err) {}</script><script type="text/javascript">swfobject.embedSWF("http://www.dbcca.com/dbcca/EN/_swf/embed-widget.swf", "dbcca-medium", "419", "132", "9.0.0", "", {},{wmode:'transparent',base:'http://www.dbcca.com'},{});</script> <p> </p> <div id="dbcca-medium" style="text-align: center; "> Please download <a href="https://www.adobe.com/go/getflashplayer/">Flash Player</a>.</div> Can anyone please tell me what to do to get it to center please. Thanks a million in advance! |