Jump to content

Search the Community

Showing results for tags 'javascript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hey all, I have a two column webpage. I would like to make my left column equal the height of the right column. The left column contains my navigation and future advertisements. My right column is my content. I would like to learn how to match the column height of the left column to that of the right column so I can add some Jquery and make the navigation/ad scroll with the user. How can this be achieved? The page is: http://cronanpilotcar.byethost33.com/page/states
  2. Having just barely got to grips with PHP, I have made a PHP app that can be used to fill out out forms, at the moment it is a step by step process, loading a different function from a PHP file full of functions, loaded one at a time; when filling in an address, it is possible to load an address previously used, this is simply done by reloading the same PHP function with a MySQL lookup, it works great as is, but to make the app work more dynamically, I'd need to allow the user to fill in the whole form in one go. However, to write the whole form in one go I'd need to load this address into a possibly half completed form... As far as I can tell this isn't something suited to PHP, I believe JavaScript is the way to go; however I have never worked with JavaScript before, I was hoping someone could point me toward some tutorials and some relevant sample code for me to read through. Thanks!
  3. I am new to php and I've downloaded a free source code for image gallery. It has admin account and you can upload image on it. Now when I upload image it generates random image title like numbers '4849404'. I want it to assign a specific title per image or just simply fetch the file name of the uploaded image and assign it as the title. How can I do that? here is the code.... $RandomNumber = rand(0, 9999999999); // We need same random name for both files. // some information about image we need later. $ImageName = strtolower($_FILES['ImageFile']['name']); $ImageSize = $_FILES['ImageFile']['size']; $TempSrc = $_FILES['ImageFile']['tmp_name']; $ImageType = $_FILES['ImageFile']['type']; $process = true; //Validate file + create image from uploaded file. switch(strtolower($ImageType)) { case 'image/png': $CreatedImage = imagecreatefrompng($_FILES['ImageFile']['tmp_name']); break; case 'image/gif': $CreatedImage = imagecreatefromgif($_FILES['ImageFile']['tmp_name']); break; case 'image/jpeg': $CreatedImage = imagecreatefromjpeg($_FILES['ImageFile']['tmp_name']); break; default: die('Unsupported File!'); //output error } //get Image Size list($CurWidth,$CurHeight)=getimagesize($TempSrc); //get file extension, this will be added after random name $ImageExt = substr($ImageName, strrpos($ImageName, '.')); $ImageExt = str_replace('.','',$ImageExt); $BigImageMaxWidth = $CurWidth; $BigImageMaxHeight = $CurHeight; //Set the Destination Image path with Random Name $thumb_DestRandImageName = $Thumb.$RandomNumber.'.'.$ImageExt; //Thumb name $DestRandImageName = $DestinationDirectory.$RandomNumber.'.'.$ImageExt; //Name for Big Image //Resize image to our Specified Size by calling our resizeImage function. if(resizeImage($CurWidth,$CurHeight,$BigImageMaxWidth,$BigImageMaxHeight,$DestRandImageName,$CreatedImage)) { //Create Thumbnail for the Image resizeImage($CurWidth,$CurHeight,$ThumbMaxWidth,$ThumbMaxHeight,$thumb_DestRandImageName,$CreatedImage); //respond with our images echo '<table width="100%" border="0" cellpadding="4" cellspacing="0"> <tr><td align="center"><img src="gallery/'.$RandomNumber.'.'.$ImageExt.'" alt="Resized Image"></td></tr></table>'; }else{ die('Resize Error'); //output error }
  4. hi guys, im new with google map, i need some help. i have ajax call, here: $('#checkbtn').click(function(e) { e.preventDefault(); var lo=$("#long").val(); var la=$('#lat').val(); $.ajax({ url:BASEURL+'register/checklocation', type:'POST', data:{log:lo,lat:la}, success:function(data) { $('#view_checkmap').html(data); } }); }); here is my view to view the map: <script> function initialize() { var myLatlng = new google.maps.LatLng(<?php echo $lat; ?>,<?php echo $long; ?>); var mapOptions = { zoom: 15, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById('mymap'), mapOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map, title: 'my location' }); } google.maps.event.addDomListener(window, 'load', initialize); </script> <div id="mymap" style="width:500px; height:300px;"></div> when i access to the URL, it displays, but when i access over ajax, nothing display. is my code worng or something else? thanks in advance.
  5. I have a form that has a drop down list that gets company details from mysql database when the company name is selected. When the form is completed it will not submit??? If I remove the script that gets the data from the database i can submit the form? I'm not the best at javascript, so could do with pointing in the right direction!! Cheers Chris <script> function showCompany(str) { if (str=="") { document.getElementById("customerDetails").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("customerDetails").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getcustomer.php?customer_id="+str,true); xmlhttp.send(); } </script>
  6. Hey guys! I am trying to achieve the following functionality; Use javascript to display page content that is stored on one page by showing the requested content through the navigation, i.e. clicking the Home link, and making the previous page content invisible. I have been playing around with altering the CSS styling off the div's. I have 3 div's each name; Home, Portfolio and Enquire. Here is the CSS for them; #home { display: block; } #portfolio { display: none; } #enquire { display: none; } So from this the home div is the first that is seen when the page loads. Now using the navigation I have I am calling a function; <nav class="row"> <ul> <li class="above-border"> </li> <li class="nav-smallfont">about</li> <li><a href="javascript:toggle_visibility('portfolio');" alt="Portfolio" target="_self">PORTFOLIO</a></li> <li class="above-border"> </li> <li class="nav-smallfont">back</li> <li><a href="javascript:toggle_visibility('home');" alt="Homepage" target="_self">HOME</a></li> <li class="above-border"> </li> <li class="nav-smallfont">furniture</li> <li><a href="#" onclick="toggle_visibility('enquire');" alt="Enquire" target="_self">ENQUIRE</a></li> <li class="above-border"> </li> </ul> </nav> I was playing around with the difference between onclick and javascript: - I didnt really see any major difference. Now my Javascript is this; <script type="text/javascript"> function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block'){ e.style.display = 'none'; } else{ e.style.display = 'block'; } } </script> Now whenever I click on the home navigation it will show/hide the content and when I click on say, the portfolio link it will show this content as well as the home. Im pretty sure you understand what I am hoping to achieve; A navigation style functionality so that when the portfolio link is click, it hides the other content and show only that and visa versa for the other links. Thanks for your help! Sam
  7. Ok so I've watch a ton of tutorials, read a few books asked a whole bunch of questions and still can't find a solution. Here is my problem, I have this form here : http://jemtechnv.com/beta/finish_ticket.php if you play with the form you will see that entering input in the Qty, and Price boxes will populate the Ext box along with sales tax and material cost and Material boxes, and input in the rate and hours box will populate the subtotal and labor boxes now here is my problem. I need to auto populate the total hours box by from the sum of the hours column and I also need to sum up the material and labor boxes and populate that total in the grand total box, sounds easy huh? you would think but here is my code that I use to calculate my sales tax : function tax(){ var materialcost = document.getElementById( 'materialcost' ).value; var shipping = document.getElementById( 'shipping' ).value; var salestax = Math.round(((materialcost / 100) * 8.1)*100)/100; var materialtotal = (materialcost * 1) + (salestax * 1) + (shipping * 1); document.getElementById( 'materialcost' ).value = materialcost; document.getElementById( 'salestax' ).value = salestax; document.getElementById( 'shipping' ).value = shipping; document.getElementById( 'materialtotal' ).value = materialtotal; } this works fine but when I try to use the materialtotal in another function to total up the materialtotal and labortotals for the grand total it causes the browser to lock up. Can someone tell me how I can get my grand total without making the script too complicated? Thanks!
  8. Does anyone know how to make link? let's say one clicks on on a pin and an info window pops up. I would like the the title in the window to become a link to the listing itself. In other words to <a href="apt.php?=<? echo "" . $row['id'] . "";>echo "" . $row['title'] . ""</a> This is what I have: The XML file: <?php require("../config.php"); function parseToXML($htmlStr) { $xmlStr=str_replace('<','<',$htmlStr); $xmlStr=str_replace('>','>',$xmlStr); $xmlStr=str_replace('"','"',$xmlStr); $xmlStr=str_replace("'",''',$xmlStr); $xmlStr=str_replace("&",'&',$xmlStr); return $xmlStr; } // Opens a connection to a mySQL server $connection=mysql_connect (DB_HOST, DB_USER, DB_PASSWORD); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active mySQL database $db_selected = mysql_select_db(DB_NAME, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM places WHERE unit='Residential' AND county='New Jersey'"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'title="' . $row['title'] . '" '; echo 'id="' . $row['id'] . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'space="' . $row['space'] . '" '; echo 'amount="$' . $row['amount'] . '" '; echo '/>'; } // End XML file echo '</markers>'; ?> The Map: <script type="text/javascript"> //<![CDATA[ var customIcons = { "House": { icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png', shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png' }, }; function load() { var map = new google.maps.Map(document.getElementById("map2"), { center: new google.maps.LatLng(40.9167, -74.1722), zoom: 11, mapTypeId: 'roadmap' }); var infoWindow = new google.maps.InfoWindow; // Change this depending on the name of your PHP file downloadUrl("commphpsqlajax_genxml.php", function(data) { var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("title"); var address = markers[i].getAttribute("amount"); var type = markers[i].getAttribute("space"); var point = new google.maps.LatLng( parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var html = "<b>" + name + "</b> <br/>" + address; var icon = customIcons[type] || {}; var marker = new google.maps.Marker({ map: map, position: point, icon: icon.icon, shadow: icon.shadow }); bindInfoWindow(marker, map, infoWindow, html); } }); } function bindInfoWindow(marker, map, infoWindow, html) { google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(html); infoWindow.open(map, marker); }); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} //]]> </script>
  9. I have this dependent radio and dropdown box, it works fine. Now I am trying to validate and its failing to validate. When i click on a radio button it should display "select a make" and If i dont select anything it should prompt me to select something rather than just submit. Also when i try to reset, what ever ive selected does not clear away. Any help will be great. Thanks in advance. Original code is from http://forums.phpfreaks.com/topic/145947-radio-button-to-change-drop-down-fields/ <html> <head> </head> <body> <form id="formname" name="formname" method="post" action="#" onsubmit="return validate()"> Make:<br> <input type="radio" name="make" value="Chrysler" onclick="changeMake(this.value);"> Chrysler<br /> <input type="radio" name="make" value="Ford" onclick="changeMake(this.value);"> Ford<br /> <input type="radio" name="make" value="GMC" onclick="changeMake(this.value);"> GMC<br /> <br> Model: <select name="model" id="model" onchange="changeModel(this.value);" disabled="disabled"> <option> -- Select a Make -- </option> </select> <br><br> Output: <span id="output"></span> <input type="reset"> <input type="submit"> </form> </body> <script type="text/javascript"> var models = new Array(); models['Chrysler'] = ['Pacifica', 'PT Cruiser', 'Sebring']; models['Ford'] = ['Ranger', 'Taurus', 'Mustang']; models['GMC'] = ['Acadia', 'Sierra', 'Yukon']; function changeMake(make) { var modelList = models[make]; changeSelect('model', modelList, modelList); document.getElementById('model').disabled = false; document.getElementById('model').onchange(); } function changeModel(modelValue) { document.getElementById('output').innerHTML = modelValue; return; } function changeSelect(fieldID, newValues, newOptions) { selectField = document.getElementById(fieldID); selectField.options.length = 0; if (newValues && newOptions) { for (i=0; i<newValues.length; i++) { selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]); } } } </script> </html>
  10. Hey there, I've been dabbling with some Javascript and I've been okay adding code in where I wanted until I came to the last part of this executing script. Basically what happens here is the Button Play Flash Game Click Here will pop open a hidden Div that shows places that they can vote at to play the game... Then what I need to happen is after the Vote Click a count down timer pops up to force a 10-15 second wait before the ShowDiv appears. I found that the script immeditately runs once the page is loaded and I have it at a 10second wait, so if I wait 10 second before clicking on anything I'll find that the Div Will Already be shown but if I quickly move through the vote it will take the 10 seconds to appear. So again what I need is for it to start the count down AFTER the vote has been cast. I'm totally newbish when it comes to Javascript I'm just good at creating frankeinsteined code by researching snippits. So please make sure you take it slow with me on this, anything outside the box of copy and paste and it might confuse the hell out of me unless you can explain a tiny bit of whats going on! I appreciate it - here's the code I'm currently using: <script type="text/javascript"> function toggle(obj){ var obj=document.getElementById(obj); if (obj.style.display == "block") obj.style.display = "none"; else obj.style.display = "block"; } </script> <br> <a href="javascript: void(0);" onClick="toggle('q1')"><center>Play Flash Game Click Here:</center></a> <div id="q1" style="display:none;"><center> <a href="javascript:ShowDiv()" onclick=window.open('http://site1.com')>Vote Site #1</a> <a href="javascript:ShowDiv()" onClick=window.open('http://site2.com')>Vote Site #2</a></div> <div id="HiddenDiv" style="display:none;"><div id="my_div"></div> <script type="text/javascript"> (function (){ var element_id = 'my_div' ; var link_text = '<center>(FLASH GAME CODE EMBEDDED HERE)</center>'; //link code var time = 10; setTimeout(function(){document.getElementById(element_id).innerHTML = link_text;},time*1000); })(); </script></div> <script language="javascript"> function ShowDiv() { document.getElementById("HiddenDiv").style.display = ''; } </script>
  11. Hello All I am having a problem trying to transfer variables from PHP to Javascript. My demonstration program: // PHP Demonstration Functions function test { $test = "HELLO WORLD"; process($test); } function process($test) { echo " <script> var jsvar; jsvar = '<?php echo $test;?>' alert(jsvar) </script> "; } The code above does not show the words HELLO WORLD instead the result is: <?php echo HELLO WORLD; ?> If I remove the single quotes it generates a javascript error. This problem has been driving me nuts for the last few hours. I appreciate any help offered. Many thanks Nikki
  12. I have a few fields in which I just want the user to input numbers. I thought I wrote the srcipt correctly but it seems not be working. Can anyone please tell me what I am doing wrong. I very new to this. Thanks <script Language="JavaScript"> <!-- function Number_Validator() { var valid = true; if(isNaN(refine_table.min_sq.value)) { alert("Only numbers are allowed in the Square Footage fields."); refine_table.min_sq.focus(); return (false); } if (!valid) alert(msg); if(isNaN(refine_table.max_sq.value)) { alert("Only numbers are allowed in the Square Footage fields."); refine_table.max_sq.focus(); return (false); } if (!valid) alert(msg); if(isNaN(refine_table.min_price.value)) { alert("Only numbers are allowed in the Amount fields."); refine_table.min_price.focus(); return (false); } if (!valid) alert(msg); if(isNaN(refine_table.max_price.value)) { alert("Only numbers are allowed in the Amount fields."); refine_table.max_price.focus(); return (false); } if (!valid) alert(msg); return valid; } --> </script>
  13. hey guys, im trying to create a website similar to craigslist and ebay except i dont know much about php, so far i have created a basic website using mostly only css and html and a little bit of javascript. but im having a hard time figuring out how to work with php is there anybody on here that would be interested in working together to build a website with me that could have the potential to make money if it is build right ?
  14. Hi, I have a php page where I get records from Mysql database and show them in a table. Now I want to add a functionality whereby if the user clicks on one particular column in the row, the whole row should be greyed out (becomes uneditable / readonly) and when the same same column is again clicked (acts as toggle field), the row becomes active again. Now when the user submits the form all the greyed out records will not be considered for further processing of the data. I am fairly new to php and would appreciate any help / pointers in the right direction to achieve this. Thanks,
  15. Hey guys! First time post here and I am only a begginer in programming. Anyway I have a few questions as I am stuck and have been for quite a while. I know this is a long post but it will cover the whole entire process of what I am doing at the moment. I really appreciate the time anyone can give me and will be happy to paypal someone over some $ for any help they can give me. Firstly, I am working with a bit of javascript and PHP. I am using a javascript method to update content from my table data in mysql without reloading the page. It works very well but I want to simplify the way i do things with the javascript so I am not left with repetative lines of code. Here is my javascript: $(document).ready(function() { //Edit link action (1) $('.edit_link').click(function(){$('.text_wrapper').hide(); var data=$('.text_wrapper').html(); $('.edit').show();$('.editbox').html(data);$('.editbox').focus();}); //Edit link action (2) $('.edit_link2').click(function(){$('.text_wrapper2').hide(); var data=$('.text_wrapper2').html();$('.edit2').show(); $('.editbox2').html(data);$('.editbox2').focus();}); //Mouseup textarea false (1) $(".editbox").mouseup(function(){return false}); //Mouseup textarea false (2) $(".editbox2").mouseup(function(){return false}); //Textarea content editing (1) $(".editbox").change(function(){$('.edit').hide();var boxval = $(".editbox").val(); var dataString = 'data='+ boxval;$.ajax({type: "POST",url: "update.php",data: dataString,cache: false,success: function(html){$('.text_wrapper').html(boxval);$('.text_wrapper').show();}});}); //Textarea content editing (2) $(".editbox2").change(function(){$('.edit2').hide(); var boxval = $(".editbox2").val();var dataString = 'data2='+ boxval;$.ajax({type: "POST",url: "update.php",data: dataString,cache: false,success: function(html){$('.text_wrapper2').html(boxval);$('.text_wrapper2').show();}});}); //Textarea without editing (1) $(document).mouseup(function(){$('.edit').hide();$('.text_wrapper').show();}); //Textarea without editing (2) $(document).mouseup(function(){$('.edit2').hide();$('.text_wrapper2').show();}); }); As you can see I am having to repeat the functions and all I do is change the name. Instead of repeating the script like I am over and over again to recognise different textareas is there a way I can array it or something like this so I don't have endless lines of the same code over and over again? I have allot more then just 2 textareas but of course shortened it for this post. Here is how I UPDATE the data in MySQL. I am looking into moving this over to PDO as I have be learning that PDO is the more safe and finctional option. My question here would be is there a simple way to UPDATE the rows instead of the way I doing this by repeating this process over and over again? I know I can use the: if (isset()); but I am troubled to work out how I would define the "id" of the data I am changing? <?php include("connection.php"); if($_POST['data']) { $data=$_POST['data']; $data = mysql_escape_String($data); $sql = "update slider set content='$data' where id='1'"; mysql_query( $sql); } if($_POST['data2']) { $data2=$_POST['data2']; $data2 = mysql_escape_String($data2); $sql = "update slider set content='$data2' where id='2'"; mysql_query( $sql); } ?> The HTML is quite simple. The form is wrapped in a div and the "edit" link is defined by class which again I repeat by just copy and past, the select is done via "id" which I need to define in the UPDATE section: <a href="#" class="edit_link" title="Edit">Edit</a> <? $sql=mysql_query("select content from slider where id='1'"); $row=mysql_fetch_array($sql); $profile=$row['content']; ?> <div class="text_wrapper" style=""><?php echo $profile; ?></div> <div class="edit" style="display:none"> <textarea class="editbox" cols="23" rows="3" name="profile_box"></textarea> </div> <a href="#" class="edit_link2" title="Edit">Edit</a> <? $sql=mysql_query("select content from slider where id='2'"); $row=mysql_fetch_array($sql); $profile=$row['content']; ?> <div class="text_wrapper2" style=""><?php echo $profile; ?></div> <div class="edit2" style="display:none"> <textarea class="editbox2" cols="23" rows="3" name="profile_box"></textarea> </div> I hate asking for help but I really need some guidence here as myself and Javascript are not good friends and myself and PHP are just starting a relationship, if you know what I mean. Any examples of how to achieve this? I do beleive if anyone could put me in the right direction it would be a great script to share around as it is very functional. I apologize for such a large post, however I really am stuck and have gone this far. I have researched google but find i just keep getting stuck. Idealy I just want to simplify the whole script, make it more functional and save myself the repetative task of going over the same thing again and again.
  16. I want to show and hide all of them at once no matter which button I click on. I'm sure there is an easy way, but I don't know javascript. <script type="text/javascript"> function showDiv() { document.getElementById('welcomeDiv').style.display = "block"; } function showDiv2() { document.getElementById('welcomeDiv2').style.display = "none"; } </script> <div id="welcomeDiv" style="display:none;" class="answer_list" > WELCOME</div> <div id="welcomeDiv2" style="display:block;" class="answer_list" > <input type="button" name="answer" value="Show Div" onclick="showDiv();showDiv2();" /></div> <div id="welcomeDiv" style="display:none;" class="answer_list" > WELCOME2</div> <div id="welcomeDiv2" style="display:block;" class="answer_list" > <input type="button" name="answer" value="Show Div" onclick="showDiv();showDiv2();" /></div> <div id="welcomeDiv" style="display:none;" class="answer_list" > WELCOME3</div> <div id="welcomeDiv2" style="display:block;" class="answer_list" > <input type="button" name="answer" value="Show Div" onclick="showDiv();showDiv2();" /></div>
  17. This opens a new window and opens the url in parent page. I just want to refresh parent, and open new window at the same time. <a href="redirect.php?=34344" onclick="window.location.reload(); window.open(this.href,'popupwindow');" >
  18. Hey guys, I am probably about to ask too much but I really do not know where to start so I am asking for help. I have a javascript code that stores an array of 366 quotes. One per day(including leap year so the code does not fail on the 366th day). I currently switched to a host that allows PHP. I would like to somehow convert the code from JS to PHP. Could anyone help? I really do not know where to start. Date.prototype.getDOY = function() {var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((this - onejan) / 86400000);} var today = new Date(); var DOY = today.getDOY(); var Quote=new Array() Quote[0]='Quote goes here'; Quote[1]='Quote goes here'; Quote[2]='Quote goes here'; Quote[3]='Quote goes here'; Quote[4]='Quote goes here'; Quote[5]='Quote goes here'; Quote[6]='Quote goes here'; Quote[7]='Quote goes here'; Quote[8]='Quote goes here'; Quote[9]='Quote goes here'; Quote[10]='Quote goes here'; Quote[11]='Quote goes here'; Quote[12]='Quote goes here'; Quote[13]='Quote goes here'; Quote[14]='Quote goes here'; Quote[15]='Quote goes here'; Quote[16]='Quote goes here'; Quote[17]='Quote goes here'; Quote[18]='Quote goes here'; Quote[19]='Quote goes here'; Quote[20]='Quote goes here'; Quote[21]='Quote goes here'; Quote[22]='Quote goes here'; Quote[23]='Quote goes here'; Quote[24]='Quote goes here'; Quote[25]='Quote goes here'; Quote[26]='Quote goes here'; Quote[27]='Quote goes here'; Quote[28]='Quote goes here'; Quote[29]='Quote goes here'; Quote[30]='Quote goes here'; Quote[31]='Quote goes here'; Quote[32]='Quote goes here'; Quote[33]='Quote goes here'; Quote[34]='Quote goes here'; Quote[35]='Quote goes here'; Quote[36]='Quote goes here'; Quote[37]='Quote goes here'; Quote[38]='Quote goes here'; Quote[39]='Quote goes here'; Quote[40]='Quote goes here'; Quote[41]='Quote goes here'; Quote[42]='Quote goes here'; Quote[43]='Quote goes here'; Quote[44]='Quote goes here'; Quote[45]='Quote goes here'; Quote[46]='Quote goes here'; Quote[47]='Quote goes here'; Quote[48]='Quote goes here'; Quote[49]='Quote goes here'; Quote[50]='Quote goes here'; Quote[51]='Quote goes here'; Quote[52]='Quote goes here'; Quote[53]='Quote goes here'; Quote[54]='Quote goes here'; Quote[55]='Quote goes here'; Quote[56]='Quote goes here'; Quote[57]='Quote goes here'; Quote[58]='Quote goes here'; Quote[59]='Quote goes here'; Quote[60]='Quote goes here'; Quote[61]='Quote goes here'; Quote[62]='Quote goes here'; Quote[63]='Quote goes here'; Quote[64]='Quote goes here'; Quote[65]='Quote goes here'; Quote[66]='Quote goes here'; Quote[67]='Quote goes here'; Quote[68]='Quote goes here'; Quote[69]='Quote goes here'; Quote[70]='Quote goes here'; Quote[71]='Quote goes here'; Quote[72]='Quote goes here'; Quote[73]='Quote goes here'; Quote[74]='Quote goes here'; Quote[75]='Quote goes here'; Quote[76]='Quote goes here'; Quote[77]='Quote goes here'; Quote[78]='Quote goes here'; Quote[79]='Quote goes here'; Quote[80]='Quote goes here'; Quote[81]='Quote goes here'; Quote[82]='Quote goes here'; Quote[83]='Quote goes here'; Quote[84]='Quote goes here'; Quote[85]='Quote goes here'; Quote[86]='Quote goes here'; Quote[87]='Quote goes here'; Quote[88]='Quote goes here'; Quote[89]='Quote goes here'; Quote[90]='Quote goes here'; Quote[91]='Quote goes here'; Quote[92]='Quote goes here'; Quote[93]='Quote goes here'; Quote[94]='Quote goes here'; Quote[95]='Quote goes here'; Quote[96]='Quote goes here'; Quote[97]='Quote goes here'; Quote[98]='Quote goes here'; Quote[99]='Quote goes here'; Quote[100]='Quote goes here'; Quote[101]='Quote goes here' Quote[102]='Quote goes here' Quote[103]='Quote goes here'; Quote[104]='Quote goes here'; Quote[105]='Quote goes here'; Quote[106]='Quote goes here'; Quote[107]='Quote goes here'; Quote[108]='Quote goes here'; Quote[109]='Quote goes here'; Quote[110]='Quote goes here'; Quote[111]='Quote goes here'; Quote[112]='Quote goes here'; Quote[113]='"People shouldn\'t be afraid of their government. Governments should be afraid of their people." - Alan Moore, V for Vendetta'; Quote[114]='"The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart." - Helen Keller'; Quote[115]='"It is during our darkest moments that we must focus to see the light." - Aristotle Onassis'; Quote[116]='“The beautiful thing about learning is that no one can take it away from you.” - B. B. King'; Quote[117]='“Luck is what happens when preparation meets opportunity.” - Seneca'; Quote[118]='“Courage is not the absence of fear, but rather the judgement that something else is more important than fear.” - James Neil Hollingworth'; Quote[119]='“Those who wish to sing, always find a song.” - Swedish Proverb'; Quote[120]='“The most powerful weapon on earth is the human soul on fire.” - Ferdinand Foch'; Quote[121]='“He who is devoid of the power to forgive, is devoid of the power to love. ” - Martin Luther King Jr.'; Quote[122]='“Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.” - Josh Billings'; Quote[123]='“Whoever said anybody has a right to give up? ” - Marian Wright Edelman'; Quote[124]='“Enthusiasm is the mother of effort, and without it nothing great was ever achieved.” - Ralph Waldo Emerson'; Quote[125]='“There are no traffic jams along the extra mile.” - Roger Staubach'; Quote[126]='“The difference between try and triumph is a little umph. ” - Anonymous'; Quote[127]='“Men exist for the sake of one another. Teach them then or bear with them.” - Marcus Aurelius Antoninus'; Quote[128]='“It is in the shelter of each other that the people live.” - Irish Proverb'; Quote[129]='“We\'re here for a reason. I believe a bit of the reason is to throw little torches out to lead people through the dark.” - Whoopi Goldberg'; Quote[130]='“Who, being loved, is poor?” - Oscar Wilde'; Quote[131]='“Love makes your soul crawl out from its hiding place.” - Zora Neale Hurst'; Quote[132]='“Start with what is right rather than what is acceptable. ” - Peter F. Drucker'; Quote[133]='“The last of the human freedoms is to choose one\'s attitudes.” - Viktor Frankl'; Quote[134]='“I will offer a choice, not an echo.” - Barry M. Goldwater'; Quote[135]='“Look at what you\'ve got and make the best of it. It is better to light a candle than to curse the darkness.” - Proverb'; Quote[136]='“Adopt the pace of nature: her secret is patience.” - Ralph Waldo Emerson'; Quote[137]='"He who destroys a good book, kills reason itself" - John Milton'; Quote[138]='“The greatest power is often simple patience.” - E. Joseph Cossman'; Quote[139]='“Perhaps the most important thing we can undertake toward the reduction of fear is to make it easier for people to accept themselves, to like themselves.” - Bonaro W. Overstreet'; Quote[140]='“Few things can help an individual more than to place responsibility on him, and to let him know that you trust him. ” - Booker T. Washington'; Quote[141]='“Those who mind don\'t matter, and those who matter don\'t mind.” - Bernard M. Baruch'; Quote[142]='"Life itself is only a vision, a dream. Nothing exists. Just empty space and you. And you, are but a thought." - Satan'; Quote[143]='“Action springs not from thought, but from a readiness for responsibility.” - Dietrich Bonhoeffer'; Quote[144]='“Put your ear down close to your soul and listen hard.” - Anne Sexton'; Quote[145]='"Quoth the raven, nevermore." - Edgar Allen Poe'; Quote[146]='“Man is so made that when anything fires his soul, impossibilities vanish.” - Jean de La Fontaine'; Quote[147]='“The heart may be broken, and the soul remain unshaken.” - Napoleon Bonaparte'; Quote[148]='"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - Stephen Roberts'; Quote[149]='“There are souls in this world which have the gift of finding joy everywhere and of leaving it behind them when they go.” - Fredrick Faber'; Quote[150]='“It is common sense to take a method and try it. If it fails, admit it frankly and try another. But above all, try something.” - Franklin D. Roosevelt'; Quote[151]='“If you think you are too small to be effective, you have never been in the dark with a mosquito.” - Unknown'; Quote[152]='“Just go out there and do what you\'ve got to do.” - Martina Navrátilová'; Quote[153]='“Nothing is at last sacred but the integrity of your own mind.” - Ralph Waldo Emerson'; Quote[154]='"Freedom is not a gift from Heaven. One must fight for it every day." - Simon Wiesenthal'; Quote[155]='“Wisdom is knowing what to do next; virtue is doing it.” - David Star Jordan'; Quote[156]='“No amount of ability is of the slightest avail without honor.” - Andrew Carnegie'; Quote[157]='“Better keep yourself clean and bright. You are the window through which you must see the world.” - George Bernard Shaw'; Quote[158]='“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.” - Charles Swindoll'; Quote[159]='“Good actions give strength to ourselves and inspire good actions in others.” - Plato'; Quote[160]='“Just don\'t give up trying to do what you really want to do. Where there\'s love and inspiration, I don\'t think you can go wrong.” - Ella Jane Fitzgerald'; Quote[161]='“If you tell a big enough lie and tell it frequently enough, it will be believed.” - Adolf Hitler'; Quote[162]='“Nothing is so strong as gentleness. Nothing is so gentle as real strength.” - Saint Francis de Sales'; Quote[163]='“The real man smiles in trouble, gathers strength from distress, and grows brave by reflection.” - Thomas Paine'; Quote[164]='“We either make ourselves miserable or we make ourselves strong. The amount of work is the same.” - Carlos Casteneda'; Quote[165]='“Were it not for hope the heart would break.” - Scottish Proverb'; Quote[166]='“No winter lasts forever; no spring skips it\'s turn.” - Hal borland'; Quote[167]='“Do not compare yourself to others. If you do so, you are insulting yourself.” - Adolf Hitler'; Quote[168]='“Once you choose hope, anything\'s possible.” - Christopher Reeve'; Quote[169]='“We must accept finite disappointment, but we must never lose infinite hope.” - Martin Luther King Jr.'; Quote[170]='“Strive to be first: first to nod, first to smile, first to compliment, and first to forgive.” - Anonymous'; Quote[171]='“Work is either fun or drudgery. It depends on your attitude. I like fun.” - Colleen C. Barrett'; Quote[172]='"A fool learns by his mistakes, a wise man learns from the mistakes of others." - The Librarian'; Quote[173]='“ \'Stay\' is a charming word in a friend\'s vocabulary.” - Louisa May Alcott'; Quote[174]='“We are all in the same boat in a stormy sea, and we owe each other a terrible loyalty.” - G. K. Chesterton'; Quote[175]='“The best things in life are never rationed. Friendship, loyalty, love, do not require coupons.” - George T. Hewitt'; Quote[176]='“It is better to be faithful than famous.” - Theodore Roosevelt'; Quote[177]='“The test of courage comes when we are in the minority. The test of tolerance comes when we are in the majority.” - Ralph W. Sockman'; Quote[178]='“Trust thyself: every heart vibrates to that iron string.” - Ralph Waldo Emerson'; Quote[179]='“Life has meaning only if one barters it day by day for something other than itself.” - Antoine de Sainte-Exupery'; Quote[180]='“No one is more cherished in this world than someone who lightens the burden of another.” - Unknown'; Quote[181]='“I can live for two months on a good compliment.” - Mark Twain'; Quote[182]='“No one\'s head aches when he is comforting another.” - Indian Proverb'; Quote[183]='“Appreciation...acknowledges the presence of good wherever you shine the light of your thankful thoughts.” - Alan Cohen'; Quote[184]='“The best way to find yourself is to lose yourself in the service of others.” - Mohandas Karamchand Gandhi'; Quote[185]='“Be a good listener. Your ears will never get you in trouble.” - Frank Tyger'; Quote[186]='“Dreams come in a size too big so that we may grow into them.” - Josie Bisset'; Quote[187]='“And the day came when the risk to remain tight in a bud was more painful than the risk it took to blossom.” - Anais Nin'; Quote[188]='“Gracefulness has been defined to be the outward expression of the inward harmony of the soul.” - William Hazlitt'; Quote[189]='“What ever beauty may be, it has for its basis order, and for its essence unity.” - Father Andre'; Quote[190]='“Example has more followers than reason.” - Christian Nestell Bovee'; Quote[191]='“A mind is a fire to be kindled, not a vessel to be filled.” - Plutarch'; Quote[192]='“To be good is noble, but to teach others how to be good is nobler--and less trouble.” - Mark Twain'; Quote[193]='“When there is no enemy within, the enemies outside cannot hurt you.” - African Proverb'; Quote[194]='“We learn more by looking for the answer to a question and not finding it than we do from learning the answer itself.” - Lloyd Alexander'; Quote[195]='“When spider webs unite they can tie up a lion.” - African Proverb'; Quote[196]='“I am a part of all that I have met.” - Alfred Tennyson, 1st Baron Tennyson'; Quote[197]='“Only a life lived for others is worth living.” - Albert Einstein'; Quote[198]='“The wise man belongs to all countries, for the home of a great soul is the whole world.” - Democritus'; Quote[199]='“Diversity is the one true thing we all have in common. Celebrate it every day.” - Unknown'; Quote[200]='“As man draws nearer to the stars, why should he not also draw nearer to his neighbor?” - Lyndon B. Johnson'; Quote[201]='“All doors open to courtesy. ” - Dr. Thomas Fuller'; Quote[202]='“Character is the total of thousands of small daily strivings to live up to the best that is in us.” - A. G. Trudeau'; Quote[203]='“With courage you will dare to take risks, have the strength to be compassionate, and the wisdom to be humble. Courage is the foundation of integrity.” - Keshavan Nair'; Quote[204]='“No steam or gas drives anything until it is confined. No life ever grows great until it is focused, dedicated, disciplined.” - Harry Emerson Fosdick'; Quote[205]='“Love yourself, accept yourself, forgive yourself, and be good to yourself, because without you the rest of us are without a source of many wonderful things.” - Dr. Leo Buscaglia'; Quote[206]='“To love means loving the unlovable. To forgive means pardoning the unpardonable. Faith means believing the unbelievable. Hope means hoping when everything seems hopeless.” - G. K. Chesterton'; Quote[207]='“When work, commitment, and pleasure all become one and you reach that deep well where passion lives, nothing is impossible.” - Nancy Coey'; Quote[208]='“It was character that got us out of bed, commitment that moved us into action, and discipline that enabled us to follow through.” - Zig Ziglar'; Quote[209]='“Reach high, for stars lie hidden in your soul. Dream deep, for every dream precedes the goal.” - Pamela Vaull Starr'; Quote[210]='“The road of life twists and turns and no two directions are ever the same. Yet our lessons come from the journey, not the destination.” - Don Williams Jr.'; Quote[211]='“Humility leads to strength and not to weakness. It is the highest form of self-respect to admit mistakes and to make amends for them.” - John J. McCloy'; Quote[212]='“Sense shines with a double luster when it is set in humility. An able and yet humble man is a jewel worth a kingdom.” - William Penn'; Quote[213]='“Dream your dream. Follow your heart. Imagine. Listen to the wind. Drink sunsets. Be free. Let the wonder never cease. Believe. Wish on EVERY star. Create adventure. Be Kind.” - Debbie Coulter'; Quote[214]='Quote goes here'; Quote[215]='Quote goes here'; Quote[216]='Quote goes here'; Quote[217]='Quote goes here'; Quote[218]='Quote goes here'; Quote[219]='Quote goes here'; Quote[220]='Quote goes here'; Quote[221]='Quote goes here'; Quote[222]='Quote goes here'; Quote[223]='Quote goes here'; Quote[224]='Quote goes here'; Quote[225]='Quote goes here'; Quote[226]='Quote goes here'; Quote[227]='Quote goes here'; Quote[228]='Quote goes here'; Quote[229]='Quote goes here'; Quote[230]='Quote goes here'; Quote[231]='Quote goes here'; Quote[232]='Quote goes here'; Quote[233]='Quote goes here'; Quote[234]='Quote goes here'; Quote[235]='Quote goes here'; Quote[236]='Quote goes here'; Quote[237]='Quote goes here'; Quote[238]='Quote goes here'; Quote[239]='Quote goes here'; Quote[240]='Quote goes here'; Quote[241]='Quote goes here'; Quote[242]='Quote goes here'; Quote[243]='Quote goes here'; Quote[244]='Quote goes here'; Quote[245]='Quote goes here'; Quote[246]='Quote goes here'; Quote[247]='Quote goes here'; Quote[248]='Quote goes here'; Quote[249]='Quote goes here'; Quote[250]='Quote goes here'; Quote[251]='Quote goes here'; Quote[252]='Quote goes here'; Quote[253]='Quote goes here'; Quote[254]='Quote goes here'; Quote[255]='Quote goes here'; Quote[256]='Quote goes here'; Quote[257]='Quote goes here'; Quote[258]='Quote goes here'; Quote[259]='Quote goes here'; Quote[260]='Quote goes here'; Quote[261]='Quote goes here'; Quote[262]='Quote goes here'; Quote[263]='Quote goes here'; Quote[264]='Quote goes here'; Quote[265]='Quote goes here'; Quote[266]='Quote goes here'; Quote[267]='Quote goes here'; Quote[268]='Quote goes here'; Quote[269]='Quote goes here'; Quote[270]='Quote goes here'; Quote[271]='Quote goes here'; Quote[272]='Quote goes here'; Quote[273]='Quote goes here'; Quote[274]='Quote goes here'; Quote[275]='Quote goes here'; Quote[276]='Quote goes here'; Quote[277]='Quote goes here'; Quote[278]='Quote goes here'; Quote[279]='Quote goes here'; Quote[280]='Quote goes here'; Quote[281]='Quote goes here'; Quote[282]='Quote goes here'; Quote[283]='Quote goes here'; Quote[284]='Quote goes here'; Quote[285]='Quote goes here'; Quote[286]='Quote goes here'; Quote[287]='Quote goes here'; Quote[288]='Quote goes here'; Quote[289]='Quote goes here'; Quote[290]='Quote goes here'; Quote[291]='Quote goes here'; Quote[292]='Quote goes here'; Quote[293]='Quote goes here'; Quote[294]='Quote goes here'; Quote[295]='Quote goes here'; Quote[296]='Quote goes here'; Quote[297]='Quote goes here'; Quote[298]='Quote goes here'; Quote[299]='Quote goes here'; Quote[300]='Quote goes here'; Quote[301]='Quote goes here' Quote[302]='Quote goes here' Quote[303]='Quote goes here'; Quote[304]='Quote goes here'; Quote[305]='Quote goes here'; Quote[306]='Quote goes here'; Quote[307]='Quote goes here'; Quote[308]='Quote goes here'; Quote[309]='Quote goes here'; Quote[310]='Quote goes here'; Quote[311]='Quote goes here'; Quote[312]='Quote goes here'; Quote[313]='Quote goes here'; Quote[314]='Quote goes here'; Quote[315]='Quote goes here'; Quote[316]='Quote goes here'; Quote[317]='Quote goes here'; Quote[318]='Quote goes here'; Quote[319]='Quote goes here'; Quote[320]='Quote goes here'; Quote[321]='Quote goes here'; Quote[322]='Quote goes here'; Quote[323]='Quote goes here'; Quote[324]='Quote goes here'; Quote[325]='Quote goes here'; Quote[326]='Quote goes here'; Quote[327]='Quote goes here'; Quote[328]='Quote goes here'; Quote[329]='Quote goes here'; Quote[330]='Quote goes here'; Quote[331]='Quote goes here'; Quote[332]='Quote goes here'; Quote[333]='Quote goes here'; Quote[334]='Quote goes here'; Quote[335]='Quote goes here'; Quote[336]='Quote goes here'; Quote[337]='Quote goes here'; Quote[338]='Quote goes here'; Quote[339]='Quote goes here'; Quote[340]='Quote goes here'; Quote[341]='Quote goes here'; Quote[342]='Quote goes here'; Quote[343]='Quote goes here'; Quote[344]='Quote goes here'; Quote[345]='Quote goes here'; Quote[346]='Quote goes here'; Quote[347]='Quote goes here'; Quote[348]='Quote goes here'; Quote[349]='Quote goes here'; Quote[350]='Quote goes here'; Quote[351]='Quote goes here'; Quote[352]='Quote goes here'; Quote[353]='Quote goes here'; Quote[354]='Quote goes here'; Quote[355]='Quote goes here'; Quote[356]='Quote goes here'; Quote[357]='Quote goes here'; Quote[358]='Quote goes here'; Quote[359]='Quote goes here'; Quote[360]='Quote goes here'; Quote[361]='Quote goes here'; Quote[362]='Quote goes here'; Quote[363]='Quote goes here'; Quote[364]='Quote goes here'; Quote[365]='Quote goes here'; function writeQuote() { document.getElementById("dayQuote").innerHTML = '<b>Quote Of The Day #'+DOY+'</b><br>'; document.getElementById("dayQuote").innerHTML += Quote[DOY]; }
  19. Is javascript navigation effective and smart? In one of my old web pages I used javascript for navigation. The code is listed below. I have knowledge of PHP includes. Currently I do not have web hosting which allows PHP(bills are tight so I opted for temporary free hosting). Would my below code be a good temporary fix until I can pay for hosting and use PHP includes? Are there any other methods? I appreciate all the help and/or ideas. var arrow = '<span>» </span>'; var clearance = 0; home = new Array(); home[1]= "<span class='asep'>Welcome</span>"; home[2]="<a href='#'>"+arrow+"Home</a>"; home[4]="<a href='http://safepiercing.org/en/piercing/body-aftercare' target='_blank'>"+arrow+"Piercing Aftercare [APP]</a>"; home[5]="<a href='#'>"+arrow+"Contact Us</a>"; computers = new Array(); computers[0]="<span class='asep'>Body Jewelry</span>"; if(clearance == 1) { computers[1]="<a href='#'>"+arrow+"Clearance</a>"; } computers[2]="<a href='#'>"+arrow+"New Arrivals</a>"; computers[3]="<a href='#'>"+arrow+"On Sale</a>"; computers[4]="<a href='#'>"+arrow+"Dermal Anchors</a>"; computers[5]="<a href='#'>"+arrow+"Barbells & Tongue Rings</a>"; computers[6]="<a href='#'>"+arrow+"Navel Rings</a>"; computers[7]="<a href='#'>"+arrow+"Non-Piercing Jewelry</a>"; computers[8]="<a href='#'>"+arrow+"Curved & Eyebrow Rings</a>"; computers[9]="<a href='#'>"+arrow+"Labret & Monroe Rings</a>"; computers[10]="<a href='#'>"+arrow+"Nipple Rings</a>"; computers[11]="<a href='#'>"+arrow+"Horse Shoes</a>"; computers[12]="<a href='#'>"+arrow+"Plugs & Tunnels</a>"; computers[13]="<a href='#'>"+arrow+"Guaged Tapers</a>"; computers[14]="<a href='#'>"+arrow+"Captive Bead Rings(CBR)</a>"; computers[15]="<a href='#'>"+arrow+"Twists & Hoops</a>"; computers[16]="<a href='#'>"+arrow+"Nose Rings</a>"; computers[17]="<a href='#'>"+arrow+"Retainers</a>"; computers[18]="<a href='#'>"+arrow+"Body Jewelry Parts</a>"; computers[19]="<a href='#'>"+arrow+"Skin Divers</a>"; computers[20]="<a href='#'>"+arrow+"Cartilage & Tragus</a>"; computers[21]="<a href='#'>"+arrow+"Fake Plugs & Tapers</a>"; computers[22]="<a href='#'>"+arrow+"316L Stainless Steel</a>"; computers[23]="<a href='#'>"+arrow+"Surgical Steel</a>"; computers[24]="<a href='#'>"+arrow+"Titanium Body Jewelry</a>"; computers[25]="<a href='#'>"+arrow+"Acrylic Body Jewelry</a>"; computers[26]="<a href='#'>"+arrow+"Organic Body Jewelry</a>"; computers[27]="<a href='#'>"+arrow+"Bio-Flex/PTFE</a>"; control = new Array(); control[1]="<span class='asep'>User Controls</span>"; control[2]="<a href='#' onclick='window.print(); return false'>"+arrow+"Print This Page</a>"; control[3]="<a href='#' onclick='addbookmark(location.href,document.title);'>"+arrow+"Bookmark Us</a>"; if(navigator.appName == "Microsoft Internet Explorer") { control[4]="<a href='#' onclick='setHomepage(\"http://google.com\");'>"+arrow+"Set As Homepage</a>"; } function writeLinks() { document.getElementById('homelinks').innerHTML = home.join(""); document.getElementById('computerslinks').innerHTML = computers.join(""); document.getElementById('usercontrol').innerHTML = control.join(""); } setTimeout(writeLinks, 0); // Fires the function on page load without stopping other loads
  20. I have written a fucntion in javascript for validation. The submit button is inside a form <input type="submit" name="submit_request" value="Submit" id="submit_req" onclick="return checkQ(event);" style="backgroundColor:Transparent;border:0;color:blue;width:100;"/> This is the function function checkQ() { //Validation var checkEmpty; //check empty text field var checkNum; //check whether authorized value is greater than the requested value var checkStr //check whether string is entered var qLength = document.getElementsByName("pQuantity[]").length; for(i=0;i<qLength;i++) { var pValue = document.getElementsByName("pQuantity[]")[i].value; //authorized quantity var reQnty = document.getElementsByName("quantity[]")[i].value; //requested quantity if(pValue != "") { checkEmpty = true; } else { alert("Quantity missing"); checkEmpty = false; return false; } if(Number(pValue)>Number(reQnty)) { alert("greater value"); checkNum = false; return false; } else { checkNum = true; } if(!Number(pValue)) { alert("You are only allowed to enter a number"); checkStr = false; return false; } else { checkStr = true; } } if(checkEmpty==true && checkNum==true && checkStr==true) { alert("working"); return true; } } It works fine in chrome and IE but for some reason even when every condition is satifisfied the form is not submitted in firefox. I get the alert dialogue box saying "working" but nothing happens after that. how to fix it
  21. Hey guys I'm at a bit of a snag. I have a script on this page [ http://vampire-news.webs.com/quote.htm ] which is supposed to show a different quote each day of the year. I have an array of 366(for leap years so the script does not fail) quotes. Each day it should display a different one. To write the quote I have a div with an ID of dayQuote and I am using document.getElementById("dayQuote").innerHTML = Quote[DOY]; to write the quote to the desired div. The issue is it doesn't work. In Chromes javascript console I get the following error "Uncaught TypeError: Cannot set property 'innerHTML' of null" I don't know what I am doing wrong. Thanks for any help.
  22. Hey guys I am currently updating my site and in all honestly I suck at javascript. My site is located at http://vampire-news.webs.com . At the top my main banner sits in the middle. I am truly considering moving my banner to the left side of the header and adding a quote of the day(or something else useful) to the right side to fill the gap. I used to have a script that did this and it worked perfectly. The issue I cannot think of a way around is a quote every day for 365 days. Can javascript use get date() and use an array of 365 objects to display a different one each day? Any help is appreciated. If I made no sense I apologize.
  23. Hi there, i'm busy with a project but know im stuck at some point. What i want to do is, when someone presses the home button it changes his color. How I wanted to do is swap from image 1 (white) to image 2 (blue). So the person can see on which page he/she is. But when i put this code into the website, it wont show nothing. When i press 2 times it will show the blue image. And when i press many times you see the white and blue image swapping. But it won't stand on the white image, only on the blue image Here is the code i use. --> <a href='' "<?php echo $this->createUrl("/admin/survey/sa/index"); ?>" onclick="edit()"><img id="img1" onclick="imageChange(this)"'<?php echo $sImageURL;?>home.png' alt='<?php $clang->eT("Default administration page");?>' /> <script type="text/javascript"> { var img1 = "/LimeSurvey/styles/scanyours/images/home.png"; var img2 = "/LimeSurvey/styles/scanyours/images/home1.png"; } { var imageChoice = 1; } function imageChange(element) { if (imageChoice == 1) { element.src = img2; imageChoice = 2; } else if (imageChoice == 2) { element.src = img1; imageChoice = 1; } } </script></a>
  24. I am a Noob at javascript so here goes. I have a slider carousel that is displayed when the webpage loads. It displays a line of images that when clicked on are displayed in larger form below it. I just want know how to automatically load (when the page firsts loads) the last uploaded on the page and then when another image is clicked from the slider carousel its loaded in its place? 2 files index and getuser.php index.php < script type="text/javascript"> jQuery(document).ready(function() { jQuery('.first-and-second-carousel').jcarousel() jQuery('#mycarousel').jcarousel({ start: 5 }); }); function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft\l ".XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getuser.php?q="+str,true); xmlhttp.send(); } </script> <ul id="first-carousel" class\l "="first-and-second-carousel jcarousel-skin-tango"> <li><?php $con = mysql_connect("localhost","base","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("users", $con); $sql = "SELECT * FROM contest ORDER BY member_id DESC"; $result = mysql_query($sql); while($file = mysql_fetch_array($result)){ echo '<li>'; echo '<a href="#" id="'.$file['member_id'].'" onclick="showUser(this.id)"><img src="'.$file['filelocation'].'" width="80" height="95" border="1"></a>'; echo '</li>'; } mysql_close($con); ?></li></ul> <div id="txtHint" style="text-align: center;"> </div> -------------------------------------------------------------------- getuser.php < ?php $q=$_GET["q"]; $con = mysql_connect("localhost","base","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("users", $con); $sql="SELECT * FROM contest WHERE member_id = '".$q."'"; $result = mysql_query($sql); while($file = mysql_fetch_array($result)){ echo '<div align="center" ><img src="'.$file['filelocation'].'" width="650" height="500" border="0"><br> < td>'.$file['title'].'</td><td><br> < td>'.$file['description']. '</td> < /div>'; } mysql_close(); ?>
  25. I'm not really sure where to post this topic... it touches on MySQL, PHP, Javascript, and best practices. I want to force users to update their password after 90 days. I can force them to the update page no problemo, but I'm having troubles forcing them to pick a new password, something different than what they have already stored in the database. Currently when a user registers for an account on my site, the password is passed in plain text and I let the MySQL Password() function hash it (I've come to understand this is bad practice). This makes it kind of difficult, because I am having a hard time verifying their new, plain text entry on the update page to the Password() hashed old one. The closest I've gotten is this: <script type="text/javascript"> function newpassword() { var oldpw = "<?php echo $XXXXXX->UserPassword; ?>"; var newpw = "<?php echo '*' . strtoupper(sha1(pack('H*',sha1('<script type="text/javascript">document.write(document.FORMNAME["UserPassword"].value);</script>'))));?>"; .... </script> And I would then compare the two variables. I'm wondering if this is even possible. I've seen a few suggestions online using UNHEX or CryptoJS, but when I use those functions my page loads with nothing on it. I've thought about passing the value as a md5 hashed value, and just storing that in the database instead, but I've read a bit that md5 isn't very secure anymore. I'm kind of at a loss of what to do at this point. Any help/guidance?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.