Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Gemini 🤖

Members
  • Posts

    86
  • Joined

  • Last visited

    Never

Everything posted by Gemini 🤖

  1. Thats all the code there is. I only have access to the code of one button..., So i have to use javascript:
  2. I'm using javascript:document.getElementById("QUESTION").innerHTML = "ANSWER"; It works perfectly. It changes the text. BUT, a millisecond after it has changed the text, It takes e to a new page with ANSWER on it. Any idea why this is happening?
  3. Thanks for that I've been playing with regex's for the last few hours and can't figure it out :'( I'll leave this thread 'open' for a little longer and see if anyone else can get it to work. All of this code is going on one line (I only have access to one button - nothing else) And in total, its already half an A4 page of code. So don't want to make it worse for myself.
  4. I'm using the code: javascript: var report = document.body.innerHTML; var ID = report.match (/id_\d{1,9}/g); alert(ID,""); To extract everything matching id_XXXXXXX where x is anywhere from 1 to 9 numbers. It returns an array perfectly. But it returns it like "id_1234567, id_6472826, id_7998326" And i want it to return it like "1234567, 6472826, 7998326" Is there an easy way to go about doing this?
  5. This will give me all the floor numbers, I only want the secretary floor number.
  6. Just secretary. There will be a few buttons. Each one 'referencing' a different office.
  7. There is about 700 offices. I want to put a button at the top of the page, and when i click that button, It will tell me which level (in this case) the secretary office is on, without me having to scroll through the list to find it.
  8. Ok, Well here is what I have got so far: var page = window.document.body.createTextRange(); var secretary = page.match (/Secretary <b>\(Floor \d{1,2}/i); onClick="MsgBox(secretary)";
  9. Firstly, I have absolutely no insight into javascript, at all. So please bear with my ignorance ??? I have a webpage with a list of locations, and what floor they are on in a building. I need to write some javascript that will (when a button is pressed) , tell me which floor the Secretary office is on, and display it in a prompt. eg: 6 Here is an example of the text on the page: .... Secretary Office (Floor 6) Employee Gym (Floor 2) .... How would I go about doing this? Many thanks in advance! edit: If it matters, here is the source of that particular part of the page: Secretary Office <b>(Floor 6)</b><br /> Employee Gym <b>(Floor 2)</b><br />
  10. anyone?
  11. Now apparently I can use : preg_match_all("^Secretary\ Office\ \(floor\ [-+]?\d+\)$",$input,$secretary); But for the love of me I can't get it to work...
  12. I have a list of Offices, and which level of a building they are on. Eg: Secretary Office (floor 12) Employee Gym (floor 7) I want to extract particular things. in this example, I want to know which level the Secretary Office is on. I thought I would try: preg_match_all("/Secretary Office (floor [1-9]?\d+/",$input,$secretary); $secretary[$x] = ltrim($secretary[$x],'Secretary Office (floor '); But it's having trouble with the ( before 'level' Giving the error: Compilation failed: missing ) Any idea how I can get around this problem?
  13. All I get as output is 'Array' when ; $notebok = ' test1 XXXXXXX test2 XXXXXXX '; $replace = $array; $find = 'XXXXXXX'; echo str_replace($find, $replace, $notebook);
  14. You page should have the .php extension
  15. Anyone?
  16. Does <?php echo 'Hello World!'; ?> work ?
  17. Sorry, I should have made myself more clear. I have an array ($array) I have a text file ($notebook) $notebook contains "James XXXXXXX test" $array contains a 7 digit number (eg 1234567) I want to replace the X's with the numbers.
  18. Thanks to Crayon Violent I have a shiny new script. <?php $input = $_POST["input"]; $notebook = "James XXXXXXX test"; preg_match_all("/id_[1-9]?\d+/",$input,$info); $info = array_reverse($info[0]); $x = 0; while ($info[$x]) { $info[$x] = ltrim($info[$x],'id_'); $x++; } foreach($info as $i) { echo $i. "<br />"; } ?> I am just wondering where in here I would put 'str_replace('XXXXXXX',$info,$notebook);' I assume this will replace the XXXXXX with the first line of $info
  19. This should work, right? str_replace(XXXXXXX,$array[0],$info)
  20. no. Each line looks like this: 14,14……11……[url=http://blah.com/index.php?id=XXXXXXX]Click1[/url]…...[url=http://blah.com/index.php?id=YYYYYYY]click2[/url]…… In this case, I want to replace XXXXXXX. In another case (with a different array) I will replace YYYYYYY maybe Str_replace will work here? Find XXXXXXX and replace with array ?
  21. Ok thanks. Makes sense. How are you feeling for one more question? ( high hopes I know ;-) 0 Let assume this returns X lines. I have another file with X lines also. [url=http://www.something.com/index.php?id=]Click[/url] I want to take line 1 of $info and put that number after 'id=' in line 1 of this other file. etc This is why I needed the array flipped. It is given back to front to the corresponding line in the next file. Any ideas?
  22. I understand it all except why you used $X here.. $x = 0; while ($info[$x]) { $info[$x] = ltrim($info[$x],'id_'); $x++; }
  23. Crayon Violent, Thats bloody brilliant! Thank you very, very much! I'm sure i'll be back tomorrow with more silly question. Until then...
  24. Scratch that. '/id_ (.+?) "/'; Should do fine also..... right?
  25. Also, from what I can find. The regex to use to select the text between "id_ and " is.... ^"id_[-+]?\d+"$ I'm just not sure how to implement it into what I want to do.
×
×
  • 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.