Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:18:15+00:00 2026-06-05T15:18:15+00:00

Here is my complete script… You can just create test.php and throw it in.

  • 0

Here is my complete script… You can just create test.php and throw it in.

It looks like this:

    <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="javascript" type="text/javascript" src="<?php echo '' . $site_url . '' ?>includes/libary.js"></script>
<script type="text/javascript">

function saveScrollPositions(theForm) {
if(theForm) {
var scrolly = typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement.scrollTop;
var scrollx = typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement.scrollLeft;
theForm.scrollx.value = scrollx;
theForm.scrolly.value = scrolly;
}
}

</script>
</head>
<body>

<div style="padding: 200px 0 200px 0;">

<?php
    $notes = $_POST['internal_notes'];
    $bonid = $_POST['reciept_id'];

    echo '<form name="notes" method="post" action="test.php" onsubmit="return saveScrollPositions(this);">';
    echo '<input type="hidden" name="scrollx" id="scrollx" value="0" />';
    echo '<input type="hidden" name="scrolly" id="scrolly" value="0" />';
    echo '<input type="hidden" name="reciept_id" value="' . $_POST['reciept_id'] . '">';
    echo '<textarea name="internal_notes">';
        if ($_POST['internal_notes'] == '') { 
        echo 'No internal notes.'; 
        } else {
        echo $_POST['internal_notes'];
        }
    echo '</textarea>';
    echo '<input type="submit" name="submit" value="Save">';
    echo '</form>';     

$scrollx = 0;
$scrolly = 0;

if(!empty($_REQUEST['scrollx'])) {
$scrollx = $_REQUEST['scrollx'];
}

if(!empty($_REQUEST['scrolly'])) {
$scrolly = $_REQUEST['scrolly'];
}
?>

</div>

<script type="text/javascript">
window.scrollTo(<?php echo "$scrollx" ?>, <?php echo "$scrolly" ?>);
</script>

This works fine. When i press Save, it posts and the page returns to the scroll position.
However i want to remove the submit-button, and insetad use onblur=”submit();” on the “internal_notes” field.

However… This does not work. How do I combine the submit and the “saveScrollPositions()” function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:18:17+00:00Added an answer on June 5, 2026 at 3:18 pm

    If your js functions are ok, I really would like to see submit(), try this:

    1) add to your form an ID, i.e: id='notes'

    2) change de onblur by this code:

    onblur="saveScrollPositions(document.getElementById('notes')); submit();" 
    

    here you can see a functional example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a complete beginner with jQuery and I have this bit of script here
I have a shell script like this. line=$@ # get the complete first line
I've spent a couple of hours looking at this and my head's spinning. Can
Here is the code. I can't make opacity animate as well. <!DOCTYPE html> <html>
I'd like to ask if this 'synchronizing-scenario' is possible with php and javascript/jQuery... I
Here is a complete example. I want to forbid using A::set from objects casted
Here is the complete error message that I get in the Package Manager Console
I am trying to submit a form with ajax. Here is my complete code
complete noob to Haskell here with probably an even noobier question. I'm trying to
Here is my code. The complete binary tree has 2^k nodes at depth k.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.