JavaScript - Make Document/ Website Viewable Only When Javascript Is Enabled
Hello,
I would like to know how to make a website (in this case, a parent div) viewable only if JavaScript is enabled? I tried to develop a code that can do this, but could not find the solution. Code: <html> <head> <script type="text/javascript"> window.onload=function() var="true" if(JavaScript.enabled) { document.getElementById('true') } OnClick() {document.getElementById('toggle').onclick=function() {document.getElementById('jahava').style.display=(document.getElementById('jahava').style.display!='none')?'none':'';}} </script> </head> <body> <noscript>You must have JavaScript enabled to view the website.</noscript> <div id="jahava">Contents Here</div> </body> </html> Similar TutorialsI heard that when we put javascript in website, then site takes time to open, is it correct ? If yes then which script is good for website.
Hi all. This is a generic question as Google didn't help at all, does anyone know how to check if javascript is enabled and then I want to display info based on that. I don't mind how I do it, HTML, PHP or whatever Regards, Magnetica Hi all, I am writing an administration panel for a web site. I want to check if the client's browser javascript enabled and if it is not enabled, a warning DIV comes telling the client to enable javascript and disable the actual page (make the actual page non-usable). Is there a way to do that? Thanks in advance telmessos Hi, a friend of mine has a problem on several (German) Legend of the Green Dragon (lotgd) servers. Sometimes, mostly after she has loged in and out for a few times during a day, she suddenly gets the message that Javascript must be enabled to log in. But it definetely IS enabled - otherwise she'd never be loged in! The error occurs - on 2 different PCs - with 2 different internet providers - with IE, FF and Opera - only on lotgd servers - any other page using Javescript are working fine We - updated and downgraded Javascript - disabled and/or uninstalled all antivirus and firewall programms - cleaned cache with CCleaner - disabled browser add ons - reinstalled Windows - disabled auto-insert passwords Even a reboot doesn't change anything. Sometimes, when she waits a few hours, she can log in again. Sometimes the error doesn't occur for days, sometimes it's there every day. That's why it is so strange. Although she doesn't change anything, the error comes and goes completely irregular. The games' admins can't or don't want to help, they say that she's the only one with that problem and that it's not a mistake in the script. What might occur that error? And what can we do to stop it?? That's what the Opera error console says: JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' CSS - http://lotgd.demonstone.org/templates/yarbrough.css Linked-in stylesheet xbackground-color is an unknown property Line 1: eight:auto;padding:1px;line-height:18px;float:left;clear:none;xbackground-color: --------------------------------------------------------------------------------^ JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' JavaScript - http://lotgd.demonstone.org/index.php Uncaught exception: ReferenceError: Undefined variable: calcMD5 Error thrown at line 1, column 0 in <anonymous function>(event): document.forms.loginform .hidden_pw.value = calcMD5(document.forms.loginform .password.value); JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' JavaScript - http://lotgd.demonstone.org/index.php Uncaught exception: ReferenceError: Undefined variable: calcMD5 Error thrown at line 1, column 0 in <anonymous function>(event): document.forms.loginform .hidden_pw.value = calcMD5(document.forms.loginform .password.value); JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' JavaScript - http://lotgd.demonstone.org/index.php Uncaught exception: ReferenceError: Undefined variable: calcMD5 Error thrown at line 1, column 0 in <anonymous function>(event): document.forms.loginform .hidden_pw.value = calcMD5(document.forms.loginform .password.value); JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' I hope someone is able to help. Thank you! Hi Everyone, Here is the question: How do I make my website viewable and usable by everyone on my network (in other words, locally)? See below for details. I'm working on a web-application (primarily Javascript and html) that will be located in a folder that everyone has access to at my company. This page is a fairly basic (a person signs-in, their name appears in a table below....the table is constantly growing). My goal is to make everyone able to dynamically add to this table. They need to be able to refresh the table and see it in its current state, and add their names to and continue growing the table. Of course, if I just place my basic web application in the folder everyone has access to, they open it to its original state. I appreciate any response. I'm VERY new to JavaScript and html, though I'm pretty well versed in a few other programming languages (VBA and MATLAB particularly), so I apologize if this is a very basic question. I'll copy in my working code so far, if that helps give a better visualization of what I mean. Code: <html> <STYLE TYPE="text/css"> body{margin: 0; padding: 0} tr.headerT { font-family: Calibri; font-size: 16pt; color: white; text-align: center } input.entryname{width: 150px;} select.optionitem{width: 150px;} .odd{background-color: white; height: 25px;} .even{background-color: E1E1E1; height: 25px;} .sidebar{background-color: AFD7E7;} </STYLE> <script language="JavaScript"> function getDate() { var TimeArray = new Date(); var o_Month = TimeArray.getMonth() + 1; var o_Day = TimeArray.getDate(); var o_Year = TimeArray.getFullYear(); o_Date = o_Month + "/" + o_Day + "/" + o_Year return o_Date } function getTime() { var TimeArray = new Date(); var o_Hours = TimeArray.getHours(); var o_Minutes = TimeArray.getMinutes(); var o_Seconds = TimeArray.getSeconds(); if (o_Hours < 10) {o_Hours = "0" + o_Hours} if (o_Minutes < 10) {o_Minutes = "0" + o_Minutes} if (o_Seconds < 10) {o_Seconds = "0" + o_Seconds} o_Time = o_Hours + ":" + o_Minutes + ":" + o_Seconds return o_Time } function Test2(tableID, selectID, inputID, selectID2) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row =table.insertRow(rowCount-1); var RowStyle = table.getElementsByTagName("tr"); var Cell1 = row.insertCell(0); var Cell2 = row.insertCell(1); var Cell3 = row.insertCell(2); var Cell4 = row.insertCell(3); var Cell5 = row.insertCell(4); var Cell6 = row.insertCell(5); var Cell7 = row.insertCell(6); var Cell8 = row.insertCell(7); var Cell9 = row.insertCell(8); var entered_name = document.getElementById(inputID).value; var selected_index = document.getElementById(selectID).selectedIndex; var selected_value = document.getElementById(selectID).options[selected_index].value; var index2 = document.getElementById(selectID2); index2.options[index2.options.length] = new Option(entered_name); index2.options[(index2.options.length)-1].value = entered_name; Cell1.className = "sidebar"; Cell2.innerHTML = getDate(); Cell2.align = "center"; Cell3.innerHTML = getTime(); Cell3.align = "center"; Cell4.innerHTML = selected_value; Cell4.align = "center"; Cell5.innerHTML = entered_name; Cell5.align = "center"; Cell9.className = "sidebar"; if((rowCount-1)%2==0){ RowStyle[rowCount-1].className = "even"; }else{ RowStyle[rowCount-1].className = "odd"; } } function Test3(tableID, selectID_rep, selectID_mem) { var dat_table = document.getElementById(tableID); var rowCount = dat_table.rows.length; var mem_select = document.getElementById(selectID_mem); var mem_index = mem_select.selectedIndex; var mem_value = mem_select.options[mem_index].value; var rep_select = document.getElementById(selectID_rep); var rep_index = rep_select.selectedIndex; var rep_value = rep_select.options[rep_index].value; for (i = 0; i<(rowCount-1); i++) { if(dat_table.rows[i].cells[4].innerHTML==mem_value) { if(dat_table.rows[i].cells[5].innerHTML=="") { dat_table.rows[i].cells[5].innerHTML = rep_value; dat_table.rows[i].cells[5].align = "center"; dat_table.rows[i].cells[6].innerHTML = getTime(); dat_table.rows[i].cells[6].align = "center"; } else if(dat_table.rows[i].cells[5].innerHTML==rep_value) { dat_table.rows[i].cells[7].innerHTML = getTime(); dat_table.rows[i].cells[7].align = "center"; mem_select.removeChild(mem_select.options[mem_index]); } } } } </script> <head> <form> <table width = 100% height = 120 border = "0" cellspacing = "0" cellpadding = "0" bgcolor = "white" id="shell" align ="center"> <tr align ="right"> <td rowspan="5" align="left" valign="top"> <IMG SRC="Logo.jpg"> </td> <td rowspan="2" colspan="2"> <IMG SRC="Title_SignIn.jpg"> </td> <td colspan="2" > <IMG SRC="Title_Staff.jpg"> </td> <td width = "10%">   </td> </tr> <tr align ="right" valign = "top" style = "height: 30px"> <td width = "30%"> Select Member:  </td> <td width = "10%"> <select name = "select_member" style = "width: 200px"> </select> </td> <td> </td> </tr> <tr align ="right" valign = "top" style = "height: 30px"> <td width = "10%"> Name:   </td> <td width = "10%"> <input type="text" name="full_name" class="entryname"> </td> <td> Representative:   </td> <td> <select name = "select_rep" style = "width: 200px"> <option value="Rep A">RV Watson</option> <option value="Rep B">Daisy Bauer</option> <option value="Rep C">Mike Andrews</option> </select> </td> </tr> <tr align ="right" valign = "top" style "hieght: 30px"> <td> Reason:   </td> <td> <select name = "reason" class = "optionitem"> <option value="Eligibility">Eligibility</option> <option value="Sick Leave">Sick Leave</option> <option value="Claims">Claims</option> <option value="Pension">Pension</option> </select></td> <td> Password:   </td> <td> Password Box </td> </tr> <tr align ="right" style = "height: 30px"> <td>   </td> <td> <input type="button" value="Sign In" name="btnSignIn" onClick="Test2('thetable', 'reason', 'full_name', 'select_member')"> </td> <td>   </td> <td> <input type="button" value="Sign Member In / Out" name="btnStaff" onClick="Test3('thetable', 'select_rep', 'select_member')"> </td> </tr> </form> </head> <table id ="thetable" width = "100%" height = "100%" border="0" valign="center" cellspacing="0" cellpadding="0" bgcolor="white" id="shell" align="center"> <tr class = "headerT" bgcolor="gray" height = "40"> <td style = "width = 50px"> </td> <td style = "width = 100px">DATE</td> <td style = "width = 150px">TIME</td> <td style = "width = 100px">REASON</td> <td style = "width = 200px">NAME</td> <td style = "width = 200px">REPRESENTATIVE</td> <td style = "width = 150px">START TIME</td> <td style = "width = 150px">END TIME</td> <td> </td> </tr> <tr> <td colspan="1" bgcolor = "AFD7E7"> </td> <td colspan="7" ></td> <td colspan="1" bgcolor = "AFD7E7"> </td> </tr> </table> </body> </html> Greetings! I am currently working on my own company's website I am currently working with the FAQ page and I need to make a simple textbox, where visitors can type and ask a question and submit it, the question the visitor typed needs to be read by javascript from a seperate xml file which should be read with javascript. Now i dont know how to start with this and I would appreciate if someone could give me a lead on what things i should do and etc. Best regards Obs Can you tell me a similar way to do this? hi everyone! i downloaded a Facebook Page template recently. the template works great, but i wanted to add one thing. here is the demo of the code: http://www.facebooktemplates2u.com/d...best_business/ here is where you can download the template: http://www.schoolofrok.com/facebook/html.zip/ anyhow, the part i want to change is the link that directs it to the content. for example, when you scroll over About Us, the little pop up from the bottom comes out. when you click it, it takes you to the About Us content. what i wanted to do, is make it so that when you click the whole jpg, it can take you to the content also. i noticed that the small link that pops up is too tiny and people get confused on where to click. any suggestions? TIA! In Jquery, there are following two concepts 1. Document.ready 2. Window.onload How can i get to know when document is ready to use using pure javascript? Hi! I'm as new as they come when it deals with website development but forums have been useful to me in the past and I'm hoping I can get some kind of direction from all the wonderful people on this forum! I have an idea for a website that I'd like to pursue, and it would need functions such as: -Live news feed -Member logins, profiles, ability to rate/leave feedback for members -Mobile phone friendly -Comment on postings -Create an intro video (maybe even with animated stick figures to explain how the site works) -Accept paypal or other payment method -And basically, need to understand the monthly maintenance cost of all these functions, how to minimize expenses, etc. I know it seems far fetched for a newbie! But I need to know if this is possible.. how would I begin implementing a site like this.. Do I need to find a programmer to code it from scratch? Are there pre-written scripts available for all the functions I listed? What can I expect the costs to be? What's the best way to move forward? Ok, so if you navigate ovr to my website "http://www.mancunianmacca.co.cc" you will notice that a box pops up asking for your name. When you type it in it adds it to the page. Is there a way I can get this to remember the users input and only ask them once then remember. Like cookie or anything. If you need any extra things. Just ask.
I have am currently taking over as the developer for this web site, and the developer who left the project unfinished wrote a script. What it does is takes posts from vBulletin forums, for instance News posts, and then it grabs the posts by ID and Title and writes the title on the home page of the web site. The problem right now that I have is the test wraps, you can see what I mean here http://www.netcodeilluminati.com/v2 If you look on the left, I want to make the text cut off after a certain amount of characters with "..." at the end as if there is more to the title but you can't see it. Here is the script: for (x = 0; x < 5; x++) { document.write("<li><div class=\"li_icon\"><img src=\"images/icons/text.png\" alt=\"text\" /></div><div class=\"li_text\">"); document.write("<a href=\"../forums/showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a></div></li>"); } I was wondering how I could go about doing this. Thanks for any future help. -Kevin I'm currently working on an HTML executor and would like users to be able to put javascript in their code if they wish to do so. Currently I have their input sent to an iframe via document.body.innerHTML. The problem, though, is that user submitted javascript doesn't work (with the exception of anything placed in the onload attribute of an image). Any suggestions?
In my program there is table which is retrieved and then there radio buttons, after selecting any radio button other columns get exapanded into textboxes to edit info. Now for expansion I have used div<id = > tag for each textbox and In javascript I have a function for showing textbox after clicking a radio button.In that I have used , arr.length=Length of the rows in table function edit1(el) { for(var i=0;i<arr.length;i++) { if(el.value==arr[i].value) { //document.getElementById("test[" + i + "]").value Not workking //document.getElementById('dname['+ i + ']').style.display = block"; Not working document.getElementById('dname').style.display = "block"; document.getElementById('dmarks').style.display = "block"; break; } else { document.getElementById('dname').style.display = "none"; document.getElementById('dmarks').style.display = "none"; } }//end for }//end if } In HTML, while($row1=mysql_fetch_array($rs1)) { echo "<tr>"; /*<td>44:<div id=d4 style="display:none;"><input type=text name=t4 id=idtext></div></td></tr><br>*/ ?> <td><input type="radio" name="select" value="<?php echo $row1['rollNo'];?>" onClick='updateRec(this);'><?php echo $row1['rollNo']; ?> <input type="radio" name="select" value="<?php echo $row1['rollNo'];?>" onClick='hiding(this);'>hide</td> <td><?php echo $row1['name']; ?><div id="dname[]" style="display:none;"><input type=text name="tname[]"></div></td> <td><?php echo $row1['marks']; ?><div id="dmarks[]" style="display:none;"><input type=text name="tmarks[]"></div></td> </tr><br> <?php } // end while ?> </table><br><br> Here I have to take array of div id's = "dname[]" but don't know the syntax for document.getElementById('dname').style.display = "block"; in which dname is array Plz help. Ok so im new to javascript and I have a button in an interface for an app. It's like drag and drop and i want this button to link you to a certain website searching for what the user types in the searchField1 box. The button is button16. Such as you type dogs into the text box and you click the google button among other search engines and it will redirect you to a google search doing a search for dogs. But how do I make this button search google and search for whats in searchField1. I would really appreciate the help. Im looking everywhere to learn this but just cant find it. If you could tell me how or send me a link to a tutorial that would be great. Thanks! Here is the code: I don't know where and what to add to do that. Please help. New to this. This code works in IE but does not work in firefox. It just stays on the same page and does nothing. Please Help! Code: <table> <CFFORM action="mypage.cfm METHOD="post" name="Login" rel="nofollow" target="_blank" id="go"> <cfinput type="hidden" name="decrypted" value="#decrypted#"> <tr> <td> <a class="K" HREF="javascript:document.go.submit();">My Page</a> </td> </tr> <tr> <td > <table> <tr> <td> <a HREF="javascript:document.go.submit();"><img border="0" src="images/icon.PNG" align="left" /></a> </td> </tr> </table> </td> </tr> </CFFORM> </table> Without elaboration plz see my code: Code: <body> <script> var b="s"; </script> <button target="_blank" onclick="window.open('http://......php?b="javascript:document.write(b);"&id=2&q=<?php print $_GET['q']; ?>','1','');return false;">xyz</button> </body> i don understand why this javascript:document.write(b); doesnt work in url... i know its simple yet it make my hair out of my head. plz count it.. I've written the following html, <html> <head> <script type="text/javascript"> function createpage(){ var first = document.getElementById('first').value var second = document.getElementById('second').value var third = document.getElementById('third').value var j = window.open('random'); var new_page = '<html><head><script type="text/javascript">function open_win() { window.open(first) window.open(second) window.open(third) } </script></head><body onLoad = "open_win()"></body></html>'; j.document.write(new_page); j.document.close(); } </script> </head> <body> <form action=""> <p> First Link: <input type="text" id="first" name="first"/> Second Link: <input type="text" id="second" name="second"/> Third Link: <input type="text" id="third" name="third"/> <input type=BUTTON value="Submit" name="mySubmit" onClick="createpage();return false;"> </p> </form> </body> </html> With the intention to eventually implement it into a website that "mashes" several URLs together into a tinyurl that, upon being opened, creates several tabs of the content the creator wanted in the single URL. Does that make sense? In order to best do this I figured a page with a random character string (I haven't yet implemented this part, for now 'random' holds the place of the new page/link) would have to be created that would launch all the tabs and then close itself. Here's what it should do... 1) User enter 3 URLs into three forms: First Link: <input type="text" id="first" name="first"/> Second Link: <input type="text" id="second" name="second"/> Third Link: <input type="text" id="third" name="third"/> 2) User clicks Submit button that calls "createpage()" function that's declared in the <head>er. The first part of this function declares the links that were inputted as variables first, second, and, third. <script type="text/javascript"> function createpage(){ var first = document.getElementById('first').value var second = document.getElementById('second').value var third = document.getElementById('third').value 3) "createpage()" function then declares a new window named 'random' to variable j (I have random.html stored in the same folder as this project. It is empty.) var j = window.open('random') 4) Next "createpage()" creates a variable that stores a full page's html code that includes a script that launches each link individually with window.open(). var new_page = '<html><head><script type="text/javascript">function open_win() { window.open(first) window.open(second) window.open(third) } </script></head><body onLoad = "open_win()"></body></html>'; 5) "createpage()" writes the code (stored in variable 'new_page') to document 'random' with j.document.write(new_page); 6) "createpage()" closes the document. The navigation for the web site I'm doing requires JS to remotely work so I want to make some kind of back-up scenario. Basicly, how can I make it so my main navigation will only display if there is script? One thought I had was put it in a div, hide it in the CSS, then use JS to show it but if there is a better way to do this I'd like to know. |