JavaScript - Bolding Javascript Text...?
Been using document.write to write onto a html file....
What if I want to make the document.write Bold..? looked everywhere but can't find anywhere with legitimate information I can understand... Code: <DOCTYPE html> <html> <head> <title> Science Practical Report Writer </title> </head> <body> <script> var none = confirm("Scientific Report Automator!") var pracName = prompt("Name Of Report") var aim = prompt("Aim Of The Experiment") var hypothesis = prompt("Hypothesis?") var equiptment = prompt("Equiptment Used:") var method = prompt("Method Used...") var results = prompt("Results?") </script> <h1> Practical Report </h1> <script> document.write(pracName + "<br><br>") document.write("Aim:" + "<br><br>") document.write(aim + "<br><br>") document.write("Hypothesis:" + "<br><br>") document.write(hypothesis + "<br><br>") document.write("Equipment:" + "<br><br>") document.write(equiptment + "<br><br>") document.write("Method:" + "<br><br>") document.write(method + "<br><br>") document.write("Results:" + "<br><br>") document.write(results + "<br><br>") </script> </body> </html> All the printed (document.write) variables, are supposed to be bold Similar TutorialsAs of right now I have a code that will work in IE but wont work in FireFox...go figure. Basically what I want to have happen is when you type in an area code it will provide an output in a predetermined area of the page. For Example: Input- 512 Output - Austin, TX The code that I have doesn't work with firefox and I was just wondering if there was a code that would allow that to happen. Thanks! i have a javascript running on my web page, however the text in the input field is white, on a white background. making it unreadable. is there a way to change the text color for the script. site can be viewed he www.barren-county.net the script running is the toolbar at the bottom, more specifically the "Connect" app on the right, if you open it you see that the text field is white and text is invisible. here is the code i have: Code: <head> {S_HEADER_TAGS} <link rel="stylesheet" type="text/css" href="{THEME_PATH}/style/style.css" /> <!-- IF S_MAIN_MENU or S_ADMIN_CSSMENU --> <link rel="stylesheet" type="text/css" href="{THEME_PATH}/style/cpgmm.css" /> <!-- ENDIF --> {CSS_IE} <script src="http://cdn.wibiya.com/Toolbars/dir_0585/Toolbar_585555/Loader_585555.js" type="text/javascript"></script> </head> <body> can you help? I have a website, and I'[m learning Javascript. Somehow, I have to type a code in my browser like this javascript:enable:_Path Or something to enable the text box so that I can enter in it. Here is the details that I'm given. This below is in the actual website with the text box disabled ( cannot enter anything in it ) Code: <td width="40%"><strong><script>document.writeln(read_str("virtual_media", "STR_VM_CDROM_IMG_PATH"));</script></strong></td> <td><input type="text" id="_path" maxlength="128" disabled style="width:140px;" /> <label id="desc" style="font-size:11px"><script>document.writeln(read_str("virtual_media", "STR_VM_CDROM_IMG_PATH_DESC"));</script></label> </td> Below is me using Google Chrome to inspect the element, the text box. shareHost=document.getElementById("_shareHost"); path=document.getElementById("_path"); user=document.getElementById("_user"); pwd=document.getElementById("_pwd"); CheckRole(); So what do I type in the URL of my broswer to activate the _path form? Do I type javascript:document.getElementById("_path) OR ("path) IF I'm wrong, correct me the way I should do it. If theirs a program that allows me to do it easier, let me know. Dear all, Can anyone help me with this… I do not know if this is possible to be done… Instead of text: "Your favorite color is <b>Green</b> right?" I need to show form like this: Code: <form action="auto.htm" method="get" > Your state<br> <select name="statecode" id="statecode"> <option value="">Choose State...</option> <option value="AK">Alaska</option> <option value="AL">Alabama</option> <option value="AR">Arkansas</option> </select> <input type="submit" name="search" value="Get Quotes" /> </form> Thank you in advance This is code I wish to modify. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> html,body { padding:0; height:100%; } #right { width:500px; height:100%; background-color:#999; text-align:center; float:right; } #left { height:100%; margin-right:500px; background-color:#f00; text-align:center; } </style> <script type="text/javascript"> function change() { switch (document.getElementById("select").value) { case "1": document.getElementById("change").innerHTML = "Your favorite color is <b>Green</b> right?" break; case "2": document.getElementById("change").innerHTML = "Your favorite color is <b>Red</b> right?" break; case "3": document.getElementById("change").innerHTML = "Your favorite color is <b>Yellow</b> right?" break; } } </script> </head> <body> What is your favorite color <select onchange="change()" id="select"> <option value="">------</option> <option value="1">Green</option> <option value="2">Red</option> <option value="3">Yellow</option> </select> <div id="change" style="margin:10px;width:200px;height:100px;padding:5px;"> Original Text </div> </body> </html> I have this code but it doesnt work: Code: <script type="text/javascript"> var number = 10; document.getelementbyid(number).value = number; </script> <input type="text" id="number" value=""> Can anybody help me out here? Hello, I am building a web application that has quotes on it. I am planning on having all the quotes stored in a .txt file. A line space would separate the quotes. Example: "Blah Blah" "Idk what blah" "sure you do" Would this be using Javascript to pull the quotes from the txt file for use in my page be best? I need it to pull all the quotes. Reason for having it like this, I am also planning on having a random quote page where it just pulls 1 quote instead of showing all of them. I'm also open to other ideas here! David Faircloth Hi, I have a drop down menu, which you select an item and the text in a text box below displays according to what has been chosen from the drop down list. I have too much text in some case to appear in the text box, so i wanted to find some code so i can select different numbers for pages so i can display the information on different pages. Is this possible. Thanks how do i make those two lines go away in the backround? EDIT: UP! http://insidehb.com/main/default.html EDIT: Now works with ie I have written a small code in Javascript which does the work of blinking all the content inside any tag with the name 'blink' here is the code <html> <body> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <p name="blink" style="visibility: visible;">This text blinks using Javascript</p> <script type="text/javascript"> function blinkText() { var x=document.getElementsByName('blink'); for(i=0;i<x.length;i++) { if(x[i].style.visibility=='visible') x[i].style.visibility='hidden'; else x[i].style.visibility='visible'; } } setTimeout('blinkText()',500); </script> </body> </html> I use a Ubuntu system and work on Mozilla 3.6.18 This hides the text successfully but does not display it again What can be wrong here? Can anyone please help me I'm making a multiple choice test, it all must be on the same page but the user must not be able to see the next question until they finish the first and click continue. Is this possible in Javascript by manipulating form object or something else? Thanks for any suggestions. I followed the tutorial below and got my image fade to work: http://clagnut.com/sandbox/imagefades/ Now I want to have text become visible once the fade is done. I can't get it to work. style portion: .enhanced { visibility:hidden; } javascript functions: <script language="javascript"> document.write("<style type='text/css'> ##thephoto {visibility:hidden;} </style>"); window.onload = function() {initImage()}; function initImage() { imageId = 'thephoto'; image = document.getElementById(imageId); setOpacity(image, 0); image.style.visibility = 'visible'; fadeIn(imageId,0); } function setOpacity(obj, opacity) { opacity = (opacity == 100)?99.999pacity; // IE/Win obj.style.filter = "alpha(opacity:"+opacity+")"; // Safari<1.2, Konqueror obj.style.KHTMLOpacity = opacity/100; // Older Mozilla and Firefox obj.style.MozOpacity = opacity/100; // Safari 1.2, newer Firefox and Mozilla, CSS3 obj.style.opacity = opacity/100; } function fadeIn(objId,opacity) { if (document.getElementById) { obj = document.getElementById(objId); if (opacity <= 100) { setOpacity(obj, opacity); opacity += 10; window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 150); } if (opacity = 100) { textId = 'enhanced'; text = document.getElementById(textId); text.style.visibility="visible"; } } } </script> I have added this to the last function: if (opacity = 100) { textId = 'enhanced'; text = document.getElementById(textId); text.style.visibility="visible"; } But the text appears instantly. Hello, I am fairly new to javascript so patience is appreciated. I have some javascript I need to execute that is located in an SSI footer. The purpose of the code is to find out what domain the page was loaded at and then to tailor some links to match. Because of how the hosting environment is set up (which I have no control over) when the links don't match the domain they aren't included. I also have to use a complete url (as opposed to relative url) because the footer is included in many different web pages. The problem is that the code is executed but it also is displayed as plain text in firefox. The test site is http://test.ci.edina.mn.us Help! The code is: Code: <script type="text/javascript"> var domainName, strOut; domainName = document.domain; strOut = '<link rel="stylesheet" type="text/css" href="http://' + domainName + '/js/jquery.fancybox/jquery.fancybox.css" media="screen" />'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery-1.3.2.min.js" type="text/javascript"></script>'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery.fancybox/jquery.fancybox-1.2.1.js" type="text/javascript"></script>'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery.easing.1.3.js" type="text/javascript"></script>'; document.write(strOut); </script> I need javascript to read height of an static multiline text and write height value into the var value? Is it possible? Hello, i m new Javascript but knows basics of functions etc. ive created a website, which also has field to Submit Email addresses for newsletters.. Now, i have a TextBox (for users to write email addresses) and a Submit button in which i want to call a Javascipt script function which OnClick takes the value(email address) from the textbox and saves it to a .txt file on server. i think i am just missing a single line, the function name which will store the value.. i searched ovr the net but didnt find it.. plz help mee. Thankyou! I'm very new at JavaScript and I'm trying to get each of the if statements below in a text text box with the result depending on the answer of the equation. However i can't figure out a way to allow the user to click a button to to show the result in a text box. If anyone could help it would be much appreciated. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <script type="text/javascript"> function calculate() { A = document.form1.text2.value B =(parseInt(A ) * 52) D= (parseInt(B ) * 0.015 ) if ( B <= 6000){ tax = 0;} else if (B <= 37001){ tax = (B - 6000) * .15; } else if (B<= 80001){ tax = (B - 37000) * .30 + (37000 - 6000) * .15; } else if (B <= 180001){ tax = (B- 80000) * .37 + (80000- 37000) * .30 + (37000 - 6000) * .15; } else tax = (B - 180000)* .45 + (180000 - 80000 begin_of_the_skype_highlighting**************180000 - 80000******end_of_the_skype_highlighting) * .37 + (80000- 37000) * .30 + (37000 - 6000) * .15;} </script> </HEAD> <BODY> <form name="form1"> Weekly Salary: <INPUT TYPE="TEXT" NAME="text2"> <INPUT TYPE="BUTTON" VALUE="SUBMIT" Onclick="calculate();"> </BODY> </HTML> Hey all, I'm sure this is very basic but I'm having a hard time adding a hyperlink to text within javascript. I want to add a website link to the text 'click here' that is being displayed under the image within javascipt. I end up modifying the whole image instead, removing the javascript that displays the larger version of the image. Can anyone help me out please? Here's the coding. I'm using Dreamweaver CS5 on a PC to modify a few things and using another website building program to get the basic layout. I'm just a small business owner trying to get my website off the ground. Thanks in advance! <div id="imCel1_01"> <div id="imCel1_01_Cont"> <div id="imObj1_01"> <a href="javascript:imShowBox('files/june2011.jpg',500,500,'Right click to print....................Click HERE for website!','IMG','t');" title=""><img src="images/p025_1_01.jpg" alt="" title="" /></a> </div> HI all, I am new to this forum and really needs your help. Please let me know how can I highlight a selected portion of an html document with javascript such that the selected portion is repeatedly shown highlighted on each and every page refresh. Thanks & Regards, Sumantra Hi guys, Am creating a web page in which a user searches a customer using customer id. The results are then displayed in a table. This is working fine. In addition to this, I have created another form in which a user enters a value in a textbox. This value is then compared to the results obtained in the previous table.The values below should be shown in green and those above in red (identical values may be shown in amber). This should be acomplished using javascript. My code is as shown below: PHP Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search Script</title> <script type="text/javascript"> function hallo(){ var value1=200 var inputVal = window.document.getElementById("one").value; //alert(negNum); if(inputVal > value1){ window.document.getElementById("color").style.color="red"; } else if(inputVal < value1) { window.document.getElementById("color").style.color="green"; } else if(inputVal == value1) { window.document.getElementById("color").style.color="#FF7E00"; } } </script> </head> <body> <form> Value1: <input type="text" name="one" id="one" ><br/> Value2: <input type="text" name="two" id="two" value="" onClick="hallo();"> <br/> Value3: <input type="text" name="three" id="$cell" value="test data"> </form> <?Php require_once("database.php"); $CustID=$_POST['CustomerID']; $query="SELECT c.*,r.Meter_No,r.January,r.February,r.March,r.April,r.May,r.June FROM customer AS c,readings AS r WHERE c.CustomerID=r.CustomerID AND c.CustomerID='".$CustID."'"; $result=mysql_query($query) ; //If no matching records are found in the database,the code below will display a customized error message $num=mysql_numrows($result)or die("No Matching Records Found In The Database!"); $fields_num = mysql_num_fields($result); echo "<h3>Historical Meter Readings</h3>"; echo "<table border='0'cellspacing='5' cellpadding='5' id ='three'><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td >{$field->name}</td>"; } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr id='color'>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td align='center' <font face='Arial, Helvetica, sans-serif' >$cell</td>"; echo "</tr >\n"; } mysql_free_result($result); ?> </body> </html> Currently my javascript code changes the entire row in the table, which is not I desired. How do I edit this script so that only values in particular CELL in a row e.g CELL 5, is changed and not the entire row? Thank you. Somebody had posted this query on how to read text files using JavaScript.......can't find that post now... Anyways, though it's not possible to read text-files using JavaScript it is possible to read XML files using it. Here is an XML based JavaScript Ticker http://www.dynamicdrive.com/dynamicindex2/xmlticker.htm It works only on browsers supporting XML (IE) Enjoy! I would like to have a Javascript WYSIWYG text editor for the site mentioned on the bottom of this post. I don't need anything complex, but basic rich text editing. I know a few of them like CKEditor, TinyCME, WMD etc. I would like to hear others' experience in the regard. Thanks. |