Jump to content

james909

Members
  • Posts

    60
  • Joined

  • Last visited

james909's Achievements

Member

Member (2/5)

0

Reputation

  1. How to a check if a php variable value is one of the following characters: A to J, or ,k to t, (ie.: A B C D E F G H I J k l m n o p q r s t) I tried: if (preg_match[A-Jk-t], $checkChar) { // do this } But it did not work
  2. thanks for the replys, all is good now I uploaded using filezilla, and it was set to 'auto' changed it to 'binary' and it displays the image i needed to do this as the script i am using requires, i could of worked through the script changing it, but now i am all the wiser and have another string to my coding bow should now always keep filezilla in binary mode?
  3. I have uploaded a png image file to my server using FTP, the file is simply '.png' but displays the broken image icon the image url is: http://www.instaworldcup.com/.png how do i get this image to display with the name '.png' as I have seen on other sites, but i am having no luck
  4. Hi programmers. Could someone please explain to me how to clear all rows from a database so that the database is empty? Thanks
  5. My site currently uses one parameter in the URL like this: http://www.mydomain.com/folder/?paramname=AB32123 I would like to remove the parameter name, so the URL is: http://www.mydomain.com/folder/?AB32123 How would I then call use this parameter, currently I use $_GET['paramname'] but without a name I am unsure how I have tried: $_GET $_GET[] but they both through up errors? what is the correct way to get this paramter without a name
  6. I have narrowed it down and the code stops at this line: window.opener.document.getElementById('c2-pic').src=nsrc; If I change the image element ID to ('c1-pic') it changes the first image, but will not change the image with the ID ('c2-pic') with this code. Both images with ID c1-pic and c2-pic image exist? I'm really scratching my head wondering why this is happened?
  7. I have the following Javascript code on a HTML page, it is a popup window to the main parent window. When the user selects a picture in this child window it changes the variable and a picture in the parent window. I have pages changepic1.html and changepic2.html. This is the code for changepic2.html which doesn't work, yet changepic1.html which works is exactly the except the 2s in in the lines commented on are 1s. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Select Image</title> <link rel="stylesheet" href="select.css"> <script> (function() { 'use strict'; function removeWindow(){ if(window.name=='wxyz'){ var pic=document.getElementById('thumbs').getElementsByTagName('img'); var c=pic.length; while(--c>-1) { pic[c].onclick=function(){ var nsrc=this.src; var nme=nme.replace(nme.substr(nme.lastIndexOf('.')),''); window.opener.document.getElementById('change2input').value=nme; // the Id is ('change1input') in other page window.opener.document.getElementById('c2-pic').src=nsrc; // the Id is ('c1-pic') in other page window.opener.document.getElementById('c2-pic').style.display ='inline'; // the Id is ('c1-pic') in other page if (nme=='Clear') { window.opener.document.getElementById('c2-pic').style.display ='none'; } // the Id is ('c1-pic') in other page window.close(); } } var txt=document.createTextNode('close this window'); var cl=document.createElement('h2'); cl.setAttribute('id','wincl'); cl.appendChild(txt); document.body.appendChild(cl); document.getElementById('wincl').onclick=function(){ window.close(); } } } window.addEventListener? window.addEventListener('load',removeWindow,false): window.attachEvent('onload',removeWindow); function closeme() { window.close(); } window.onblur=closeme; })(); </script> </head> <body> <ul id="thumbs"> <li><img src="redGround-1.png" ></li> <li><img src="yellowFlat-2.png" ></li> <li><img src="bigCurve-3.png" ></li> <li><img src="smallCurve-4.png" ></li> </body> change1input and change2input are hidden input fields in the parent window and both exist. c1-pic and c2-pic are the div ids of the image to change in the parent window. This window doesn't close when the image is clicked, but the other page works fine. I can't understand why the page that changes pic 1 works but this page that changes pic 2 doesn't, when they have the exact same code?
  8. Here is my Code, It is a popup to change an image main window, I am trying to get the image to display if image 2,3 or 4 are selected, and no image to display is image 1 is selected. It all works except getting the If statement to check whether image 1 is selected or not: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Select an Armor</title> <link rel="stylesheet" href="selectwindow.css"> <script> (function() { 'use strict'; function removeWindow(){ if(window.name='wxyz'){ var pic=document.getElementById('thumbs').getElementsByTagName('img'); var c=pic.length; while(--c>-1) { pic[c].onclick=function(){ window.opener.document.getElementById('windowc').src=this.src.replace('-thumb',''); window.opener.document.getElementById('windowc').style.display="inline"; if(pic.src=="pics/Image1.png") { window.opener.document.getElementById('a1windowchange').style.display="none"; } window.close(); } } var txt=document.createTextNode('close this window'); var cl=document.createElement('h2'); cl.setAttribute('id','wincl'); cl.appendChild(txt); document.body.appendChild(cl); document.getElementById('wincl').onclick=function(){ window.close(); } } } window.addEventListener? window.addEventListener('load',removeWindow,false): window.attachEvent('onload',removeWindow); function closeme() { window.close(); } window.onblur=closeme; })(); </script> </head> <body> <ul id="thumbs"> <li><img src="pics/Image1.png" alt=""></li> <li><img src="pics/Image2.png" alt=""></li> <li><img src="pics/Image3.png" alt=""></li> <li><img src="pics/Image4.png" alt=""></li> </ul> </body> What is the correct way to code: if(pic.src=="pics/Image1.png") To check whether pics/Image1.png has been selected or not?
  9. When I click an image I am trying to get another window to open (500px by 500px) which can be scrolled down, that sits on top of the current browser screen, which displays multiple images (that are 50px by 50px), when one of these images is clicked it sets a javascript global variable in the current browser screen as that image name, and changes the image that was originally clicked in the current browser to the new image. Can anyone supply any sample code of how I would achieve this
  10. Here is my code inside a function(): for (var i=1; i<6; i++) { for (var j=1; j<11; j++) { if (h" + i + "w" + j" == "t") { var build = "Bulk"; } if (h" + i + "w" + j" == "z") { var build = "Master"; } if (h" + i + "w" + j" == "T") { var build = "Storage"; } parambuild = parambuild+build; } } I am atempting to get check what letters globally declared vars: h1w1, h1w2, h1w3, h1w4 .... etc .... to h5w10 contain and then make a string such as: BulkMasterBulkBulkStorageBulk But in the current code the string contains: undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedun......
  11. Thank you trq, code looks good I will try that. and I was just using document.write to see what the javascript var contained
  12. I can assign the variables fine like this: var h1 = "<?php echo $array[1][h] ?>", h2 = "<?php echo $array[2][h] ?>", h3 = "<?php echo $array[3][h] ?>", etc..... Trying to loop this
  13. Thanks trq, so is there anyway to use the javascript loop increments number inside php variable value echo?
  14. I am trying to declare javascript variables from php array values using a loop. Trying to declare javascript var h1 as php array value from $array[1][h], and h2 as $array[2][h], and h3 as $array[3][h],and so on... Here is my code: <SCRIPT LANGUAGE="JavaScript"> for (var i=0;i<61;i++) { var h[i] = "<?php echo $array[i][h] ?>"; var hl[i] = "<?php echo $array[i][hl] ?>"; var hs[i] = "<?php echo $array[i][hs] ?>"; } </script> When I <script type="text/javascript"> document.write(h1); </script> it is blank
×
×
  • 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.